Bug 1368012 - Get rid of audio-channel-process-changed observer in ProcessPriorityManager, r=gsvelto
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 26 May 2017 17:49:55 +0200
changeset 585324 d40d37c7b0c11646fe6f329138eaf61468cf3426
parent 585323 6994cbd66d9751acd87d5005f9eb67e7eea62af2
child 585325 cb62a593770c8e7d02ae8344c018abe79a747406
push id61093
push userdgottwald@mozilla.com
push dateFri, 26 May 2017 20:16:26 +0000
reviewersgsvelto
bugs1368012
milestone55.0a1
Bug 1368012 - Get rid of audio-channel-process-changed observer in ProcessPriorityManager, r=gsvelto
dom/ipc/ProcessPriorityManager.cpp
--- a/dom/ipc/ProcessPriorityManager.cpp
+++ b/dom/ipc/ProcessPriorityManager.cpp
@@ -309,17 +309,16 @@ public:
    * The reference returned here is guaranteed to be live until the next call
    * to NameWithComma() or until the ParticularProcessPriorityManager is
    * destroyed, whichever comes first.
    */
   const nsAutoCString& NameWithComma();
 
   bool IsExpectingSystemMessage();
 
-  void OnAudioChannelProcessChanged(nsISupports* aSubject);
   void OnRemoteBrowserFrameShown(nsISupports* aSubject);
   void OnTabParentDestroyed(nsISupports* aSubject);
   void OnFrameloaderVisibleChanged(nsISupports* aSubject);
   void OnActivityOpened(const char16_t* aData);
   void OnActivityClosed(const char16_t* aData);
 
   ProcessPriority CurrentPriority();
   ProcessPriority ComputePriority();
@@ -690,17 +689,16 @@ ParticularProcessPriorityManager::Static
 
 void
 ParticularProcessPriorityManager::Init()
 {
   RegisterWakeLockObserver(this);
 
   nsCOMPtr<nsIObserverService> os = services::GetObserverService();
   if (os) {
-    os->AddObserver(this, "audio-channel-process-changed", /* ownsWeak */ true);
     os->AddObserver(this, "remote-browser-shown", /* ownsWeak */ true);
     os->AddObserver(this, "ipc:browser-destroyed", /* ownsWeak */ true);
     os->AddObserver(this, "frameloader-visible-changed", /* ownsWeak */ true);
     os->AddObserver(this, "activity-opened", /* ownsWeak */ true);
     os->AddObserver(this, "activity-closed", /* ownsWeak */ true);
   }
 
   // This process may already hold the CPU lock; for example, our parent may
@@ -763,19 +761,17 @@ ParticularProcessPriorityManager::Observ
 {
   if (!mContentParent) {
     // We've been shut down.
     return NS_OK;
   }
 
   nsDependentCString topic(aTopic);
 
-  if (topic.EqualsLiteral("audio-channel-process-changed")) {
-    OnAudioChannelProcessChanged(aSubject);
-  } else if (topic.EqualsLiteral("remote-browser-shown")) {
+  if (topic.EqualsLiteral("remote-browser-shown")) {
     OnRemoteBrowserFrameShown(aSubject);
   } else if (topic.EqualsLiteral("ipc:browser-destroyed")) {
     OnTabParentDestroyed(aSubject);
   } else if (topic.EqualsLiteral("frameloader-visible-changed")) {
     OnFrameloaderVisibleChanged(aSubject);
   } else if (topic.EqualsLiteral("activity-opened")) {
     OnActivityOpened(aData);
   } else if (topic.EqualsLiteral("activity-closed")) {
@@ -818,29 +814,16 @@ ParticularProcessPriorityManager::NameWi
   }
 
   mNameWithComma = NS_ConvertUTF16toUTF8(name);
   mNameWithComma.AppendLiteral(", ");
   return mNameWithComma;
 }
 
 void
-ParticularProcessPriorityManager::OnAudioChannelProcessChanged(nsISupports* aSubject)
-{
-  nsCOMPtr<nsIPropertyBag2> props = do_QueryInterface(aSubject);
-  NS_ENSURE_TRUE_VOID(props);
-
-  uint64_t childID = CONTENT_PROCESS_ID_UNKNOWN;
-  props->GetPropertyAsUint64(NS_LITERAL_STRING("childID"), &childID);
-  if (childID == ChildID()) {
-    ResetPriority();
-  }
-}
-
-void
 ParticularProcessPriorityManager::OnRemoteBrowserFrameShown(nsISupports* aSubject)
 {
   nsCOMPtr<nsIFrameLoader> fl = do_QueryInterface(aSubject);
   NS_ENSURE_TRUE_VOID(fl);
 
   TabParent* tp = TabParent::GetFrom(fl);
   NS_ENSURE_TRUE_VOID(tp);