Skip to content

Instantly share code, notes, and snippets.

@valenting
Created January 10, 2017 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valenting/334d399ea6a72e7c6b49e46aafb163d1 to your computer and use it in GitHub Desktop.
Save valenting/334d399ea6a72e7c6b49e46aafb163d1 to your computer and use it in GitHub Desktop.
# HG changeset patch
# User Valentin Gosu <valentin.gosu@gmail.com>
# Parent a9f76166af0ffd2598d1d0f2fe5a7cd1f64de60f
[mq]: timestamp.patch
MozReview-Commit-ID: J7XgQJ6YRwz
diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -986,22 +986,31 @@ ContentChild::InitXPCOM()
bool isOffline, isLangRTL, haveBidiKeyboards;
bool isConnected;
int32_t captivePortalState;
ClipboardCapabilities clipboardCaps;
DomainPolicyClone domainPolicy;
StructuredCloneData initialData;
OptionalURIParams userContentSheetURL;
+ mozilla::TimeStamp childNow1 = TimeStamp::Now();
+ mozilla::TimeStamp parentNow1;
+ mozilla::TimeStamp parentNow2;
SendGetXPCOMProcessAttributes(&isOffline, &isConnected, &captivePortalState,
+ &parentNow1, &parentNow2,
&isLangRTL, &haveBidiKeyboards,
&mAvailableDictionaries,
&clipboardCaps, &domainPolicy, &initialData,
&mFontFamilies, &userContentSheetURL,
&mLookAndFeelCache);
+ mozilla::TimeStamp childNow2 = TimeStamp::Now();
+
+ mozilla::TimeDuration delta = ((parentNow1 - childNow1) + (parentNow2 - childNow2)) / (int64_t) 2;
+ printf("timediff: %lf\n", delta.ToMicroseconds());
+ Unused << delta;
RecvSetOffline(isOffline);
RecvSetConnectivity(isConnected);
RecvSetCaptivePortalState(captivePortalState);
RecvBidiKeyboardNotify(isLangRTL, haveBidiKeyboards);
// Create the CPOW manager as soon as possible.
SendPJavaScriptConstructor();
diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2494,26 +2494,29 @@ ContentParent::RecvGetProcessAttributes(
return IPC_OK();
}
mozilla::ipc::IPCResult
ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
bool* aIsConnected,
int32_t* aCaptivePortalState,
+ TimeStamp* aParentNow1,
+ TimeStamp* aParentNow2,
bool* aIsLangRTL,
bool* aHaveBidiKeyboards,
InfallibleTArray<nsString>* dictionaries,
ClipboardCapabilities* clipboardCaps,
DomainPolicyClone* domainPolicy,
StructuredCloneData* aInitialData,
InfallibleTArray<FontFamilyListEntry>* fontFamilies,
OptionalURIParams* aUserContentCSSURL,
nsTArray<LookAndFeelInt>* aLookAndFeelIntCache)
{
+ *aParentNow1 = TimeStamp::Now();
Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS,
static_cast<uint32_t>((TimeStamp::Now() - mLaunchTS)
.ToMilliseconds()));
nsCOMPtr<nsIIOService> io(do_GetIOService());
MOZ_ASSERT(io, "No IO service?");
DebugOnly<nsresult> rv = io->GetOffline(aIsOffline);
MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?");
@@ -2582,16 +2585,17 @@ ContentParent::RecvGetXPCOMProcessAttrib
// send the file URL instead.
StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet();
if (ucs) {
SerializeURI(ucs->GetSheetURI(), *aUserContentCSSURL);
} else {
SerializeURI(nullptr, *aUserContentCSSURL);
}
+ *aParentNow2 = TimeStamp::Now();
return IPC_OK();
}
mozilla::jsipc::PJavaScriptParent *
ContentParent::AllocPJavaScriptParent()
{
MOZ_ASSERT(ManagedPJavaScriptParent().IsEmpty());
return nsIContentParent::AllocPJavaScriptParent();
diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -716,16 +716,18 @@ private:
virtual mozilla::ipc::IPCResult RecvGetProcessAttributes(ContentParentId* aCpId,
bool* aIsForBrowser) override;
virtual mozilla::ipc::IPCResult
RecvGetXPCOMProcessAttributes(bool* aIsOffline,
bool* aIsConnected,
int32_t* aCaptivePortalState,
+ TimeStamp* aParentNow1,
+ TimeStamp* aParentNow2,
bool* aIsLangRTL,
bool* aHaveBidiKeyboards,
InfallibleTArray<nsString>* dictionaries,
ClipboardCapabilities* clipboardCaps,
DomainPolicyClone* domainPolicy,
StructuredCloneData* initialData,
InfallibleTArray<FontFamilyListEntry>* fontFamilies,
OptionalURIParams* aUserContentSheetURL,
diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -90,16 +90,17 @@ using struct LookAndFeelInt from "mozill
using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";
using mozilla::DataStorageType from "ipc/DataStorageIPCUtils.h";
using mozilla::DocShellOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using struct mozilla::dom::FlyWebPublishOptions from "mozilla/dom/FlyWebPublishOptionsIPCSerializer.h";
using mozilla::Telemetry::Accumulation from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::KeyedAccumulation from "mozilla/TelemetryComms.h";
+using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
union ChromeRegistryItem
{
ChromePackage;
OverrideMapping;
SubstitutionMapping;
};
@@ -656,16 +657,18 @@ parent:
* |isForBrowser|, we're loading <browser> or <xul:browser remote>.
*
* Keep the return values in sync with PBrowser()!
*/
sync GetProcessAttributes()
returns (ContentParentId cpId, bool isForBrowser);
sync GetXPCOMProcessAttributes()
returns (bool isOffline, bool isConnected, int32_t captivePortalState,
+ TimeStamp parentNow1,
+ TimeStamp parentNow2,
bool isLangRTL,
bool haveBidiKeyboards, nsString[] dictionaries,
ClipboardCapabilities clipboardCaps,
DomainPolicyClone domainPolicy,
StructuredCloneData initialData,
FontFamilyListEntry[] fontFamilies /* used on MacOSX only */,
OptionalURIParams userContentSheetURL,
LookAndFeelInt[] lookAndFeelIntCache);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment