Bug 1158798 - Properly initialize the LookAndFeel cache in the child. r=mstange.
authorMike Conley <mconley@mozilla.com>
Fri, 10 Jul 2015 17:11:59 -0400
changeset 252429 836d79194ff1bd3789b8d5a05af8ab858db20d58
parent 252428 aea2836ce9fecb317d04c3c49ce5122049239d96
child 252430 7ab0df390753c1be668ca0491651722b36cec85d
push id62147
push usermconley@mozilla.com
push dateSat, 11 Jul 2015 02:55:18 +0000
treeherdermozilla-inbound@836d79194ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1158798
milestone42.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 1158798 - Properly initialize the LookAndFeel cache in the child. r=mstange. The old code was just flat-out wrong. The IPDL for getting the LookAndFeel cache from the parent during child process initialization was passing an array it wanted to be populated as an argument, rather than using a return value.
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
widget/cocoa/nsLookAndFeel.h
widget/cocoa/nsLookAndFeel.mm
widget/nsXPLookAndFeel.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4024,19 +4024,19 @@ ContentParent::RecvGetSystemMemory(const
 #endif
 
     unused << SendSystemMemoryAvailable(aGetterId, memoryTotal);
 
     return true;
 }
 
 bool
-ContentParent::RecvGetLookAndFeelCache(nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache)
-{
-    aLookAndFeelIntCache = LookAndFeel::GetIntCache();
+ContentParent::RecvGetLookAndFeelCache(nsTArray<LookAndFeelInt>* aLookAndFeelIntCache)
+{
+    *aLookAndFeelIntCache = LookAndFeel::GetIntCache();
     return true;
 }
 
 bool
 ContentParent::RecvIsSecureURI(const uint32_t& type,
                                const URIParams& uri,
                                const uint32_t& flags,
                                bool* isSecureURI)
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -756,17 +756,17 @@ private:
                                                      const bool& aHidden) override;
 
     virtual bool RecvAudioChannelServiceStatus(const bool& aTelephonyChannel,
                                                const bool& aContentOrNormalChannel,
                                                const bool& aAnyChannel) override;
 
     virtual bool RecvGetSystemMemory(const uint64_t& getterId) override;
 
-    virtual bool RecvGetLookAndFeelCache(nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache) override;
+    virtual bool RecvGetLookAndFeelCache(nsTArray<LookAndFeelInt>* aLookAndFeelIntCache) override;
 
     virtual bool RecvDataStoreGetStores(
                        const nsString& aName,
                        const nsString& aOwner,
                        const IPC::Principal& aPrincipal,
                        InfallibleTArray<DataStoreSetting>* aValue) override;
 
     virtual bool RecvSpeakerManagerGetSpeakerStatus(bool* aValue) override;
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -728,17 +728,18 @@ parent:
     prio(urgent) sync GetRandomValues(uint32_t length)
         returns (uint8_t[] randomValues);
 
     async GetSystemMemory(uint64_t getterId);
 
     sync IsSecureURI(uint32_t type, URIParams uri, uint32_t flags)
         returns (bool isSecureURI);
 
-    sync GetLookAndFeelCache(LookAndFeelInt[] lookAndFeelIntCache);
+    sync GetLookAndFeelCache()
+        returns (LookAndFeelInt[] lookAndFeelIntCache);
 
     prio(urgent) async PHal();
 
     PIcc(uint32_t serviceId);
 
     PMobileConnection(uint32_t clientId);
 
     PNecko();
--- a/widget/cocoa/nsLookAndFeel.h
+++ b/widget/cocoa/nsLookAndFeel.h
@@ -22,17 +22,17 @@ public:
   {
     // unicode value for the bullet character, used for password textfields.
     return 0x2022;
   }
 
   static bool UseOverlayScrollbars();
 
   virtual nsTArray<LookAndFeelInt> GetIntCacheImpl();
-  virtual void SetIntCacheImpl(const nsTArray<LookAndFeelInt>& lookAndFeelIntCache);
+  virtual void SetIntCacheImpl(const nsTArray<LookAndFeelInt>& aLookAndFeelIntCache);
 
   virtual void RefreshImpl();
 protected:
 
   // Apple hasn't defined a constant for scollbars with two arrows on each end, so we'll use this one.
   static const int kThemeScrollBarArrowsBoth = 2;
   static const int kThemeScrollBarArrowsUpperLeft = 3;
 
--- a/widget/cocoa/nsLookAndFeel.mm
+++ b/widget/cocoa/nsLookAndFeel.mm
@@ -663,19 +663,19 @@ nsLookAndFeel::GetIntCacheImpl()
   allowOverlayScrollbarsOverlap.id = eIntID_AllowOverlayScrollbarsOverlap;
   allowOverlayScrollbarsOverlap.value = GetInt(eIntID_AllowOverlayScrollbarsOverlap);
   lookAndFeelIntCache.AppendElement(allowOverlayScrollbarsOverlap);
 
   return lookAndFeelIntCache;
 }
 
 void
-nsLookAndFeel::SetIntCacheImpl(const nsTArray<LookAndFeelInt>& lookAndFeelIntCache)
+nsLookAndFeel::SetIntCacheImpl(const nsTArray<LookAndFeelInt>& aLookAndFeelIntCache)
 {
-  for (auto entry : lookAndFeelIntCache) {
+  for (auto entry : aLookAndFeelIntCache) {
     switch(entry.id) {
       case eIntID_UseOverlayScrollbars:
         mUseOverlayScrollbars = entry.value;
         mUseOverlayScrollbarsCached = true;
         break;
       case eIntID_AllowOverlayScrollbarsOverlap:
         mAllowOverlayScrollbarsOverlap = entry.value;
         mAllowOverlayScrollbarsOverlapCached = true;
--- a/widget/nsXPLookAndFeel.cpp
+++ b/widget/nsXPLookAndFeel.cpp
@@ -456,17 +456,17 @@ nsXPLookAndFeel::Init()
     sUseNativeColors = val;
   }
 
   if (XRE_IsContentProcess()) {
     mozilla::dom::ContentChild* cc =
       mozilla::dom::ContentChild::GetSingleton();
 
     nsTArray<LookAndFeelInt> lookAndFeelIntCache;
-    cc->SendGetLookAndFeelCache(lookAndFeelIntCache);
+    cc->SendGetLookAndFeelCache(&lookAndFeelIntCache);
     LookAndFeel::SetIntCache(lookAndFeelIntCache);
   }
 }
 
 nsXPLookAndFeel::~nsXPLookAndFeel()
 {
   NS_ASSERTION(sInstance == this,
                "This destroying instance isn't the singleton instance");