From 7039884fe620763621d0a9a5aa15b966e54d8288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Thu, 25 Mar 2021 12:52:11 +0000 Subject: [PATCH] Bug 1698129 - Rename the profiler browsingContextID outputs to tabID and bump the profile version r=gerald Lastly, we are changing the parts that requires a version bump and bumping the profiler version in the end. This will require a PR in the front-end for a version upgrader and changes related to the renaming. Differential Revision: https://phabricator.services.mozilla.com/D109282 --- mozglue/baseprofiler/core/PageInformation.cpp | 2 +- mozglue/baseprofiler/core/platform.cpp | 2 +- tools/profiler/core/PageInformation.cpp | 2 +- tools/profiler/core/platform.cpp | 5 ++--- .../browser_test_profile_multi_frame_page_info.js | 8 ++++---- .../browser_test_profile_single_frame_page_info.js | 4 ++-- .../tests/xpcshell/test_active_configuration.js | 12 ++++++------ 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/mozglue/baseprofiler/core/PageInformation.cpp b/mozglue/baseprofiler/core/PageInformation.cpp index ef1cbdd2f1cd..bb7c7872aac1 100644 --- a/mozglue/baseprofiler/core/PageInformation.cpp +++ b/mozglue/baseprofiler/core/PageInformation.cpp @@ -34,7 +34,7 @@ void PageInformation::StreamJSON(SpliceableJSONWriter& aWriter) const { // Window IDs are created using `nsContentUtils::GenerateProcessSpecificId`, // which is specifically designed to only use 53 of the 64 bits to be lossless // when passed into and out of JS as a double. - aWriter.DoubleProperty("browsingContextID", TabID()); + aWriter.DoubleProperty("tabID", TabID()); aWriter.DoubleProperty("innerWindowID", InnerWindowID()); aWriter.StringProperty("url", Url()); aWriter.DoubleProperty("embedderInnerWindowID", EmbedderInnerWindowID()); diff --git a/mozglue/baseprofiler/core/platform.cpp b/mozglue/baseprofiler/core/platform.cpp index aaeceb030eed..3d5b2efe2b0b 100644 --- a/mozglue/baseprofiler/core/platform.cpp +++ b/mozglue/baseprofiler/core/platform.cpp @@ -1851,7 +1851,7 @@ static void StreamMetaJSCustomObject(PSLockRef aLock, bool aIsShuttingDown) { MOZ_RELEASE_ASSERT(CorePS::Exists() && ActivePS::Exists(aLock)); - aWriter.IntProperty("version", 19); + aWriter.IntProperty("version", 23); // The "startTime" field holds the number of milliseconds since midnight // January 1, 1970 GMT. This grotty code computes (Now - (Now - diff --git a/tools/profiler/core/PageInformation.cpp b/tools/profiler/core/PageInformation.cpp index 98b403193afa..ebb905341495 100644 --- a/tools/profiler/core/PageInformation.cpp +++ b/tools/profiler/core/PageInformation.cpp @@ -28,7 +28,7 @@ void PageInformation::StreamJSON(SpliceableJSONWriter& aWriter) const { // which is specifically designed to only use 53 of the 64 bits to be lossless // when passed into and out of JS as a double. aWriter.StartObjectElement(); - aWriter.DoubleProperty("browsingContextID", TabID()); + aWriter.DoubleProperty("tabID", TabID()); aWriter.DoubleProperty("innerWindowID", InnerWindowID()); aWriter.StringProperty("url", Url()); aWriter.DoubleProperty("embedderInnerWindowID", EmbedderInnerWindowID()); diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index a66b7262cdd1..2581e0f97fd2 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -1028,8 +1028,7 @@ class ActivePS { // being created using `nsContentUtils::GenerateProcessSpecificId`, which // is specifically designed to only use 53 of the 64 bits to be lossless // when passed into and out of JS as a double. - aWriter.DoubleProperty("activeBrowsingContextID", - sInstance->mActiveTabID); + aWriter.DoubleProperty("activeTabID", sInstance->mActiveTabID); } aWriter.EndObject(); } @@ -2538,7 +2537,7 @@ static void StreamMetaJSCustomObject( const PreRecordedMetaInformation& aPreRecordedMetaInformation) { MOZ_RELEASE_ASSERT(CorePS::Exists() && ActivePS::Exists(aLock)); - aWriter.IntProperty("version", 22); + aWriter.IntProperty("version", 23); // The "startTime" field holds the number of milliseconds since midnight // January 1, 1970 GMT. This grotty code computes (Now - (Now - diff --git a/tools/profiler/tests/browser/browser_test_profile_multi_frame_page_info.js b/tools/profiler/tests/browser/browser_test_profile_multi_frame_page_info.js index 12b381606e71..fc36e5d007d6 100644 --- a/tools/profiler/tests/browser/browser_test_profile_multi_frame_page_info.js +++ b/tools/profiler/tests/browser/browser_test_profile_multi_frame_page_info.js @@ -61,8 +61,8 @@ add_task(async function test_profile_multi_frame_page_info() { // Parent page if (page.url == url) { Assert.equal(page.url, url); - Assert.equal(typeof page.browsingContextID, "number"); - Assert.equal(page.browsingContextID, activeTabID); + Assert.equal(typeof page.tabID, "number"); + Assert.equal(page.tabID, activeTabID); Assert.equal(typeof page.innerWindowID, "number"); // Top level document will have no embedder. Assert.equal(page.embedderInnerWindowID, 0); @@ -78,8 +78,8 @@ add_task(async function test_profile_multi_frame_page_info() { // Child page (iframe) if (page.url == BASE_URL + "single_frame.html") { Assert.equal(page.url, BASE_URL + "single_frame.html"); - Assert.equal(typeof page.browsingContextID, "number"); - Assert.equal(page.browsingContextID, activeTabID); + Assert.equal(typeof page.tabID, "number"); + Assert.equal(page.tabID, activeTabID); Assert.equal(typeof page.innerWindowID, "number"); Assert.equal(typeof page.embedderInnerWindowID, "number"); Assert.notEqual(typeof parentPage, "undefined"); diff --git a/tools/profiler/tests/browser/browser_test_profile_single_frame_page_info.js b/tools/profiler/tests/browser/browser_test_profile_single_frame_page_info.js index 6f3a5c9bb604..b1800381ecbb 100644 --- a/tools/profiler/tests/browser/browser_test_profile_single_frame_page_info.js +++ b/tools/profiler/tests/browser/browser_test_profile_single_frame_page_info.js @@ -58,8 +58,8 @@ add_task(async function test_profile_single_frame_page_info() { for (const page of contentProcess.pages) { if (page.url == url) { Assert.equal(page.url, url); - Assert.equal(typeof page.browsingContextID, "number"); - Assert.equal(page.browsingContextID, activeTabID); + Assert.equal(typeof page.tabID, "number"); + Assert.equal(page.tabID, activeTabID); Assert.equal(typeof page.innerWindowID, "number"); // Top level document will have no embedder. Assert.equal(page.embedderInnerWindowID, 0); diff --git a/tools/profiler/tests/xpcshell/test_active_configuration.js b/tools/profiler/tests/xpcshell/test_active_configuration.js index 10c3ff6a0f61..3c7dc4524408 100644 --- a/tools/profiler/tests/xpcshell/test_active_configuration.js +++ b/tools/profiler/tests/xpcshell/test_active_configuration.js @@ -23,13 +23,13 @@ function run_test() { const interval = 1; const threads = ["GeckoMain"]; const features = ["js", "leaf", "threads"]; - const activeBrowsingContextID = 123; + const activeTabID = 123; Services.profiler.StartProfiler( entries, interval, features, threads, - activeBrowsingContextID + activeTabID ); info("Generate the activeConfiguration."); @@ -38,7 +38,7 @@ function run_test() { interval, threads, features, - activeBrowsingContextID, + activeTabID, // The buffer is created as a power of two that can fit all of the entires // into it. If the ratio of entries to buffer size ever changes, this setting // will need to be updated. @@ -65,7 +65,7 @@ function run_test() { const interval = 0.5; const threads = ["GeckoMain", "DOM Worker"]; const features = ["threads"]; - const activeBrowsingContextID = 111; + const activeTabID = 111; const duration = 20; info("Restart the profiler with a new configuration."); @@ -74,7 +74,7 @@ function run_test() { interval, features, threads, - activeBrowsingContextID, + activeTabID, // Also start it with duration, this property is optional. duration ); @@ -85,7 +85,7 @@ function run_test() { interval, threads, features, - activeBrowsingContextID, + activeTabID, duration, // The buffer is created as a power of two that can fit all of the entires // into it. If the ratio of entries to buffer size ever changes, this setting