Bug 836654 - Part 0: Add constants CONTENT_PROCESS_{UNKNOWN_ID,MAIN_ID} to HalTypes.h and remove the equivalent constants from ContentParent.h. r=cjones
authorJustin Lebar <justin.lebar@gmail.com>
Thu, 14 Feb 2013 15:41:29 -0500
changeset 121962 d87c3a49bff187ffbe5f1784546136f9dc2b153f
parent 121961 d1738e1adece807fc5d2b91f8ce97a19fa8bb40e
child 121963 e74011e49190a0c13dd9d469bcf83def1b9cd81f
push id24314
push userryanvm@gmail.com
push dateFri, 15 Feb 2013 14:39:46 +0000
treeherdermozilla-central@326c5e4868fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs836654
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 836654 - Part 0: Add constants CONTENT_PROCESS_{UNKNOWN_ID,MAIN_ID} to HalTypes.h and remove the equivalent constants from ContentParent.h. r=cjones
dom/audiochannel/AudioChannelService.cpp
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
hal/HalTypes.h
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -20,16 +20,17 @@
 
 #include "nsThreadUtils.h"
 
 #ifdef MOZ_WIDGET_GONK
 #include "nsIAudioManager.h"
 #endif
 using namespace mozilla;
 using namespace mozilla::dom;
+using namespace mozilla::hal;
 
 StaticRefPtr<AudioChannelService> gAudioChannelService;
 
 // static
 AudioChannelService*
 AudioChannelService::GetAudioChannelService()
 {
   MOZ_ASSERT(NS_IsMainThread());
@@ -88,17 +89,17 @@ AudioChannelService::~AudioChannelServic
 void
 AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
                                                AudioChannelType aType)
 {
   AudioChannelAgentData* data = new AudioChannelAgentData(aType,
                                                           true /* mElementHidden */,
                                                           true /* mMuted */);
   mAgents.Put(aAgent, data);
-  RegisterType(aType, CONTENT_PARENT_NO_CHILD_ID);
+  RegisterType(aType, CONTENT_PROCESS_ID_MAIN);
 }
 
 void
 AudioChannelService::RegisterType(AudioChannelType aType, uint64_t aChildID)
 {
   AudioChannelInternalType type = GetInternalType(aType, true);
   mChannelCounters[type].AppendElement(aChildID);
 
@@ -112,17 +113,17 @@ AudioChannelService::RegisterType(AudioC
 
 void
 AudioChannelService::UnregisterAudioChannelAgent(AudioChannelAgent* aAgent)
 {
   nsAutoPtr<AudioChannelAgentData> data;
   mAgents.RemoveAndForget(aAgent, data);
 
   if (data) {
-    UnregisterType(data->mType, data->mElementHidden, CONTENT_PARENT_NO_CHILD_ID);
+    UnregisterType(data->mType, data->mElementHidden, CONTENT_PROCESS_ID_MAIN);
   }
 }
 
 void
 AudioChannelService::UnregisterType(AudioChannelType aType,
                                     bool aElementHidden,
                                     uint64_t aChildID)
 {
@@ -146,17 +147,17 @@ AudioChannelService::GetMuted(AudioChann
   if (!mAgents.Get(aAgent, &data)) {
     return true;
   }
 
   bool oldElementHidden = data->mElementHidden;
   // Update visibility.
   data->mElementHidden = aElementHidden;
 
-  bool muted = GetMutedInternal(data->mType, CONTENT_PARENT_NO_CHILD_ID,
+  bool muted = GetMutedInternal(data->mType, CONTENT_PROCESS_ID_MAIN,
                                 aElementHidden, oldElementHidden);
   data->mMuted = muted;
 
   SendAudioChannelChangedNotification();
   return muted;
 }
 
 bool
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -885,17 +885,17 @@ ContentParent::GetTestShellSingleton()
     return static_cast<TestShellParent*>(ManagedPTestShellParent()[0]);
 }
 
 ContentParent::ContentParent(const nsAString& aAppManifestURL,
                              bool aIsForBrowser,
                              ChildPrivileges aOSPrivileges)
     : mSubprocess(nullptr)
     , mOSPrivileges(aOSPrivileges)
-    , mChildID(CONTENT_PARENT_UNKNOWN_CHILD_ID)
+    , mChildID(CONTENT_PROCESS_ID_UNKNOWN)
     , mGeolocationWatchID(-1)
     , mRunToCompletionDepth(0)
     , mShouldCallUnblockChild(false)
     , mAppManifestURL(aAppManifestURL)
     , mForceKillTask(nullptr)
     , mNumDestroyingTabs(0)
     , mIsAlive(true)
     , mIsDestroyed(false)
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -10,34 +10,32 @@
 #include "base/waitable_event_watcher.h"
 
 #include "mozilla/dom/PContentParent.h"
 #include "mozilla/dom/PMemoryReportRequestParent.h"
 #include "mozilla/dom/TabContext.h"
 #include "mozilla/ipc/GeckoChildProcessHost.h"
 #include "mozilla/dom/ipc/Blob.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/HalTypes.h"
 
 #include "nsFrameMessageManager.h"
 #include "nsIObserver.h"
 #include "nsIThreadInternal.h"
 #include "nsNetUtil.h"
 #include "nsIPermissionManager.h"
 #include "nsIDOMGeoPositionCallback.h"
 #include "nsIMemoryReporter.h"
 #include "nsCOMArray.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 #include "PermissionMessageUtils.h"
 
 #define CHILD_PROCESS_SHUTDOWN_MESSAGE NS_LITERAL_STRING("child-process-shutdown")
 
-#define CONTENT_PARENT_NO_CHILD_ID 0
-#define CONTENT_PARENT_UNKNOWN_CHILD_ID -1
-
 class mozIApplication;
 class nsConsoleService;
 class nsIDOMBlob;
 
 namespace mozilla {
 
 namespace ipc {
 class OptionalURIParams;
--- a/hal/HalTypes.h
+++ b/hal/HalTypes.h
@@ -7,16 +7,22 @@
 #define mozilla_hal_Types_h
 
 #include "IPCMessageUtils.h"
 
 namespace mozilla {
 namespace hal {
 
 /**
+ * XXX
+ */
+const uint64_t CONTENT_PROCESS_ID_UNKNOWN = uint64_t(-1);
+const uint64_t CONTENT_PROCESS_ID_MAIN = 0;
+
+/**
  * These are defined by libhardware, specifically, hardware/libhardware/include/hardware/lights.h
  * in the gonk subsystem.
  * If these change and are exposed to JS, make sure nsIHal.idl is updated as well.
  */
 enum LightType {
   eHalLightID_Backlight     = 0,
   eHalLightID_Keyboard      = 1,
   eHalLightID_Buttons       = 2,