Skip to content

Commit

Permalink
Bug 1318764 - Get rid of GetLookAndFeelCache sync IPC message, and se…
Browse files Browse the repository at this point in the history
…nd cache with GetXPCOMProcessAttributes instead. r=billm

MozReview-Commit-ID: 7BzG2WqNYLO

--HG--
extra : rebase_source : a6d2510b63cefe2895172a082d9a4c67c12944f5
  • Loading branch information
mikeconley committed Nov 18, 2016
1 parent b4e6fa3 commit ab867d5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
4 changes: 3 additions & 1 deletion dom/ipc/ContentChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,9 @@ ContentChild::InitXPCOM()
&isLangRTL, &haveBidiKeyboards,
&mAvailableDictionaries,
&clipboardCaps, &domainPolicy, &initialData,
&mFontFamilies, &userContentSheetURL);
&mFontFamilies, &userContentSheetURL,
&mLookAndFeelCache);

RecvSetOffline(isOffline);
RecvSetConnectivity(isConnected);
RecvSetCaptivePortalState(captivePortalState);
Expand Down
8 changes: 8 additions & 0 deletions dom/ipc/ContentChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct SubstitutionMapping;
struct OverrideMapping;
class nsIDomainPolicy;
class nsIURIClassifierCallback;
struct LookAndFeelInt;

namespace mozilla {
class RemoteSpellcheckEngineChild;
Expand Down Expand Up @@ -621,6 +622,11 @@ class ContentChild final : public PContentChild
virtual bool
DeallocPURLClassifierChild(PURLClassifierChild* aActor) override;

nsTArray<LookAndFeelInt>&
LookAndFeelCache() {
return mLookAndFeelCache;
}

/**
* Helper function for protocols that use the GPU process when available.
* Overrides FatalError to just be a warning when communicating with the
Expand Down Expand Up @@ -650,6 +656,8 @@ class ContentChild final : public PContentChild
// parent process and used to initialize gfx in the child. Currently used
// only on MacOSX.
InfallibleTArray<mozilla::dom::FontFamilyListEntry> mFontFamilies;
// Temporary storage for nsXPLookAndFeel flags.
nsTArray<LookAndFeelInt> mLookAndFeelCache;

/**
* An ID unique to the process containing our corresponding
Expand Down
11 changes: 3 additions & 8 deletions dom/ipc/ContentParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2479,7 +2479,8 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
DomainPolicyClone* domainPolicy,
StructuredCloneData* aInitialData,
InfallibleTArray<FontFamilyListEntry>* fontFamilies,
OptionalURIParams* aUserContentCSSURL)
OptionalURIParams* aUserContentCSSURL,
nsTArray<LookAndFeelInt>* aLookAndFeelIntCache)
{
nsCOMPtr<nsIIOService> io(do_GetIOService());
MOZ_ASSERT(io, "No IO service?");
Expand Down Expand Up @@ -2544,6 +2545,7 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,

// This is only implemented (returns a non-empty list) by MacOSX at present.
gfxPlatform::GetPlatform()->GetSystemFontFamilyList(fontFamilies);
*aLookAndFeelIntCache = LookAndFeel::GetIntCache();

// Content processes have no permission to access profile directory, so we
// send the file URL instead.
Expand Down Expand Up @@ -3235,13 +3237,6 @@ ContentParent::RecvNSSU2FTokenSign(nsTArray<uint8_t>&& aApplication,
return IPC_OK();
}

mozilla::ipc::IPCResult
ContentParent::RecvGetLookAndFeelCache(nsTArray<LookAndFeelInt>* aLookAndFeelIntCache)
{
*aLookAndFeelIntCache = LookAndFeel::GetIntCache();
return IPC_OK();
}

mozilla::ipc::IPCResult
ContentParent::RecvIsSecureURI(const uint32_t& type,
const URIParams& uri,
Expand Down
5 changes: 2 additions & 3 deletions dom/ipc/ContentParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,8 @@ class ContentParent final : public PContentParent
DomainPolicyClone* domainPolicy,
StructuredCloneData* initialData,
InfallibleTArray<FontFamilyListEntry>* fontFamilies,
OptionalURIParams* aUserContentSheetURL) override;
OptionalURIParams* aUserContentSheetURL,
nsTArray<LookAndFeelInt>* aLookAndFeelIntCache) override;

virtual bool
DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*) override;
Expand Down Expand Up @@ -928,8 +929,6 @@ class ContentParent final : public PContentParent
const bool& aContentOrNormalChannel,
const bool& aAnyChannel) override;

virtual mozilla::ipc::IPCResult RecvGetLookAndFeelCache(nsTArray<LookAndFeelInt>* aLookAndFeelIntCache) override;

virtual mozilla::ipc::IPCResult RecvKeywordToURI(const nsCString& aKeyword,
nsString* aProviderName,
OptionalInputStreamParams* aPostData,
Expand Down
6 changes: 2 additions & 4 deletions dom/ipc/PContent.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,8 @@ parent:
DomainPolicyClone domainPolicy,
StructuredCloneData initialData,
FontFamilyListEntry[] fontFamilies /* used on MacOSX only */,
OptionalURIParams userContentSheetURL);
OptionalURIParams userContentSheetURL,
LookAndFeelInt[] lookAndFeelIntCache);

sync CreateChildProcess(IPCTabContext context,
ProcessPriority priority,
Expand Down Expand Up @@ -768,9 +769,6 @@ parent:

async AccumulateMixedContentHSTS(URIParams uri, bool active, bool hasHSTSPriming);

sync GetLookAndFeelCache()
returns (LookAndFeelInt[] lookAndFeelIntCache);

nested(inside_cpow) async PHal();

async PHeapSnapshotTempFileHelper();
Expand Down
6 changes: 3 additions & 3 deletions widget/nsXPLookAndFeel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,9 @@ nsXPLookAndFeel::Init()
mozilla::dom::ContentChild* cc =
mozilla::dom::ContentChild::GetSingleton();

nsTArray<LookAndFeelInt> lookAndFeelIntCache;
cc->SendGetLookAndFeelCache(&lookAndFeelIntCache);
LookAndFeel::SetIntCache(lookAndFeelIntCache);
LookAndFeel::SetIntCache(cc->LookAndFeelCache());
// This is only ever used once during initialization, and can be cleared now.
cc->LookAndFeelCache().Clear();
}
}

Expand Down

0 comments on commit ab867d5

Please sign in to comment.