зеркало из https://github.com/mozilla/gecko-dev.git
Bug 834936 - Temporarily load JSMs into fewer compartments; r=rnewman
We concatenate JSMs together so we use less compartments and therefore less memory. This is intended to be a temporary hack until the overhead of compartments is less.
This commit is contained in:
Родитель
a97dbeda57
Коммит
95d334535a
|
@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
modules := \
|
||||
async.js \
|
||||
bagheeraclient.js \
|
||||
log4moz.js \
|
||||
observers.js \
|
||||
preferences.js \
|
||||
|
@ -45,6 +44,10 @@ INSTALL_TARGETS += MODULES
|
|||
TESTING_JS_MODULES := $(addprefix modules-testing/,$(testing_modules))
|
||||
TESTING_JS_MODULE_DIR := services-common
|
||||
|
||||
PP_JS_MODULES := bagheeraclient.js
|
||||
PP_JS_MODULES_PATH = $(FINAL_TARGET)/modules/services-common
|
||||
PP_TARGETS += PP_JS_MODULES
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# What follows is a helper to launch a standalone storage server instance.
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
#ifndef MERGED_COMPARTMENT
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"BagheeraClient",
|
||||
"BagheeraClientRequestResult",
|
||||
|
@ -18,6 +20,8 @@ this.EXPORTED_SYMBOLS = [
|
|||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
#endif
|
||||
|
||||
Cu.import("resource://gre/modules/commonjs/promise/core.js");
|
||||
Cu.import("resource://services-common/log4moz.js");
|
||||
Cu.import("resource://services-common/rest.js");
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/services/datareporting/policy.jsm");
|
||||
Cu.import("resource://gre/modules/services/datareporting/sessions.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://services-common/observers.js");
|
||||
Cu.import("resource://services-common/preferences.js");
|
||||
|
@ -223,7 +221,7 @@ DataReportingService.prototype = Object.freeze({
|
|||
// Lazy import so application startup isn't adversely affected.
|
||||
|
||||
Cu.import("resource://gre/modules/Task.jsm", ns);
|
||||
Cu.import("resource://gre/modules/services/healthreport/healthreporter.jsm", ns);
|
||||
Cu.import("resource://gre/modules/HealthReport.jsm", ns);
|
||||
Cu.import("resource://services-common/log4moz.js", ns);
|
||||
|
||||
// How many times will we rewrite this code before rolling it up into a
|
||||
|
@ -257,3 +255,10 @@ DataReportingService.prototype = Object.freeze({
|
|||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DataReportingService]);
|
||||
|
||||
#define MERGED_COMPARTMENT
|
||||
|
||||
#include policy.jsm
|
||||
;
|
||||
#include sessions.jsm
|
||||
;
|
||||
|
||||
|
|
|
@ -11,15 +11,18 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
TEST_DIRS += tests
|
||||
|
||||
MODULES_FILES := policy.jsm sessions.jsm
|
||||
MODULES_DEST = $(FINAL_TARGET)/modules/services/datareporting
|
||||
INSTALL_TARGETS += MODULES
|
||||
MODULES := policy.jsm sessions.jsm
|
||||
MODULES_PATH = $(FINAL_TARGET)/modules/services/datareporting
|
||||
PP_TARGETS += MODULES
|
||||
|
||||
TESTING_JS_MODULES := $(addprefix modules-testing/,mocks.jsm)
|
||||
TESTING_JS_MODULE_DIR := services/datareporting
|
||||
|
||||
EXTRA_COMPONENTS := \
|
||||
DataReporting.manifest \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_PP_COMPONENTS := \
|
||||
DataReportingService.js \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
#ifndef MERGED_COMPARTMENT
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"DataSubmissionRequest", // For test use only.
|
||||
"DataReportingPolicy",
|
||||
|
@ -22,6 +24,8 @@ this.EXPORTED_SYMBOLS = [
|
|||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
#endif
|
||||
|
||||
Cu.import("resource://gre/modules/commonjs/promise/core.js");
|
||||
Cu.import("resource://services-common/log4moz.js");
|
||||
Cu.import("resource://services-common/utils.js");
|
||||
|
|
|
@ -4,12 +4,16 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
#ifndef MERGED_COMPARTMENT
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"SessionRecorder",
|
||||
];
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
#endif
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://services-common/log4moz.js");
|
||||
Cu.import("resource://services-common/preferences.js");
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"HealthReporter",
|
||||
"AddonsProvider",
|
||||
"AppInfoProvider",
|
||||
"CrashesProvider",
|
||||
"Metrics",
|
||||
"ProfileMetadataProvider",
|
||||
"SessionsProvider",
|
||||
"SysInfoProvider",
|
||||
];
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
// We concatenate the JSMs together to eliminate compartment overhead.
|
||||
// This is a giant hack until compartment overhead is no longer an
|
||||
// issue.
|
||||
#define MERGED_COMPARTMENT
|
||||
|
||||
#include ../common/bagheeraclient.js
|
||||
;
|
||||
#include ../metrics/Metrics.jsm
|
||||
;
|
||||
#include healthreporter.jsm
|
||||
;
|
||||
#include profile.jsm
|
||||
;
|
||||
#include providers.jsm
|
||||
;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
# Register Firefox Health Report providers.
|
||||
category healthreport-js-provider AddonsProvider resource://gre/modules/services/healthreport/providers.jsm
|
||||
category healthreport-js-provider AppInfoProvider resource://gre/modules/services/healthreport/providers.jsm
|
||||
category healthreport-js-provider CrashesProvider resource://gre/modules/services/healthreport/providers.jsm
|
||||
category healthreport-js-provider SysInfoProvider resource://gre/modules/services/healthreport/providers.jsm
|
||||
category healthreport-js-provider ProfileMetadataProvider resource://gre/modules/services/healthreport/profile.jsm
|
||||
category healthreport-js-provider SessionsProvider resource://gre/modules/services/healthreport/providers.jsm
|
||||
category healthreport-js-provider AddonsProvider resource://gre/modules/HealthReport.jsm
|
||||
category healthreport-js-provider AppInfoProvider resource://gre/modules/HealthReport.jsm
|
||||
category healthreport-js-provider CrashesProvider resource://gre/modules/HealthReport.jsm
|
||||
category healthreport-js-provider SysInfoProvider resource://gre/modules/HealthReport.jsm
|
||||
category healthreport-js-provider ProfileMetadataProvider resource://gre/modules/HealthReport.jsm
|
||||
category healthreport-js-provider SessionsProvider resource://gre/modules/HealthReport.jsm
|
||||
|
||||
|
|
|
@ -21,9 +21,13 @@ testing_modules := \
|
|||
|
||||
TEST_DIRS += tests
|
||||
|
||||
MODULES_FILES := $(modules)
|
||||
MODULES_DEST = $(FINAL_TARGET)/modules/services/healthreport
|
||||
INSTALL_TARGETS += MODULES
|
||||
MAIN_JS_MODULE := HealthReport.jsm
|
||||
MAIN_JS_MODULE_PATH = $(FINAL_TARGET)/modules
|
||||
PP_TARGETS += MAIN_JS_MODULE
|
||||
|
||||
MODULES := $(modules)
|
||||
MODULES_PATH = $(FINAL_TARGET)/modules/services/healthreport
|
||||
PP_TARGETS += MODULES
|
||||
|
||||
TESTING_JS_MODULES := $(addprefix modules-testing/,$(testing_modules))
|
||||
TESTING_JS_MODULE_DIR := services/healthreport
|
||||
|
|
|
@ -4,17 +4,23 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
#ifndef MERGED_COMPARTMENT
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["HealthReporter"];
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://services-common/async.js");
|
||||
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
Cu.import("resource://gre/modules/Metrics.jsm");
|
||||
Cu.import("resource://services-common/bagheeraclient.js");
|
||||
#endif
|
||||
|
||||
Cu.import("resource://services-common/async.js");
|
||||
Cu.import("resource://services-common/log4moz.js");
|
||||
Cu.import("resource://services-common/preferences.js");
|
||||
Cu.import("resource://services-common/utils.js");
|
||||
Cu.import("resource://gre/modules/commonjs/promise/core.js");
|
||||
Cu.import("resource://gre/modules/Metrics.jsm");
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
@ -26,7 +32,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||
const OLDEST_ALLOWED_YEAR = 2012;
|
||||
|
||||
const DAYS_IN_PAYLOAD = 180;
|
||||
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
const DEFAULT_DATABASE_NAME = "healthreport.sqlite";
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ Cu.import("resource://gre/modules/FileUtils.jsm");
|
|||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/services-common/utils.js");
|
||||
Cu.import("resource://gre/modules/services/healthreport/healthreporter.jsm");
|
||||
Cu.import("resource://gre/modules/HealthReport.jsm");
|
||||
|
||||
|
||||
let APP_INFO = {
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
#ifndef MERGED_COMPARTMENT
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"ProfileCreationTimeAccessor",
|
||||
"ProfileMetadataProvider",
|
||||
|
@ -11,12 +13,16 @@ this.EXPORTED_SYMBOLS = [
|
|||
|
||||
const {utils: Cu, classes: Cc, interfaces: Ci} = Components;
|
||||
|
||||
const DEFAULT_PROFILE_MEASUREMENT_NAME = "age";
|
||||
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
Cu.import("resource://gre/modules/Metrics.jsm");
|
||||
|
||||
#endif
|
||||
|
||||
const DEFAULT_PROFILE_MEASUREMENT_NAME = "age";
|
||||
const REQUIRED_UINT32_TYPE = {type: "TYPE_UINT32"};
|
||||
|
||||
Cu.import("resource://gre/modules/commonjs/promise/core.js");
|
||||
Cu.import("resource://gre/modules/Metrics.jsm");
|
||||
Cu.import("resource://gre/modules/osfile.jsm")
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
Cu.import("resource://services-common/log4moz.js");
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
#ifndef MERGED_COMPARTMENT
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"AddonsProvider",
|
||||
"AppInfoProvider",
|
||||
|
@ -25,9 +27,12 @@ this.EXPORTED_SYMBOLS = [
|
|||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Metrics.jsm");
|
||||
|
||||
#endif
|
||||
|
||||
Cu.import("resource://gre/modules/commonjs/promise/core.js");
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
Cu.import("resource://gre/modules/Metrics.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
|
|
@ -14,5 +14,7 @@ function run_test() {
|
|||
let resource = "resource://gre/modules/services/healthreport/" + m;
|
||||
Components.utils.import(resource, {});
|
||||
}
|
||||
|
||||
Components.utils.import("resource://gre/modules/HealthReport.jsm", {});
|
||||
}
|
||||
|
||||
|
|
|
@ -21,13 +21,15 @@ testing_modules := \
|
|||
|
||||
# We install Metrics.jsm into the "main" JSM repository and the rest in
|
||||
# services. External consumers should only go through Metrics.jsm.
|
||||
EXTRA_JS_MODULES := Metrics.jsm
|
||||
MAIN_JS_MODULE := Metrics.jsm
|
||||
MAIN_JS_MODULE_PATH = $(FINAL_TARGET)/modules
|
||||
PP_TARGETS += MAIN_JS_MODULE
|
||||
|
||||
TEST_DIRS += tests
|
||||
|
||||
MODULES_FILES := $(modules)
|
||||
MODULES_DEST = $(FINAL_TARGET)/modules/services/metrics
|
||||
INSTALL_TARGETS += MODULES
|
||||
JS_MODULES := $(modules)
|
||||
JS_MODULES_PATH = $(FINAL_TARGET)/modules/services/metrics
|
||||
PP_TARGETS += JS_MODULES
|
||||
|
||||
TESTING_JS_MODULES := $(addprefix modules-testing/,$(testing_modules))
|
||||
TESTING_JS_MODULE_DIR := services/metrics
|
||||
|
|
|
@ -4,14 +4,27 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
#ifndef MERGED_COMPARTMENT
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["Metrics"];
|
||||
|
||||
const {utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/services/metrics/collector.jsm");
|
||||
Cu.import("resource://gre/modules/services/metrics/dataprovider.jsm");
|
||||
Cu.import("resource://gre/modules/services/metrics/storage.jsm");
|
||||
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
#endif
|
||||
|
||||
// We concatenate the JSMs together to eliminate compartment overhead.
|
||||
// This is a giant hack until compartment overhead is no longer an
|
||||
// issue.
|
||||
#define MERGED_COMPARTMENT
|
||||
|
||||
#include collector.jsm
|
||||
;
|
||||
#include dataprovider.jsm
|
||||
;
|
||||
#include storage.jsm
|
||||
;
|
||||
|
||||
this.Metrics = {
|
||||
Collector: Collector,
|
||||
|
|
|
@ -4,15 +4,18 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
#ifndef MERGED_COMPARTMENT
|
||||
this.EXPORTED_SYMBOLS = ["Collector"];
|
||||
|
||||
const {utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/services/metrics/dataprovider.jsm");
|
||||
#endif
|
||||
|
||||
Cu.import("resource://gre/modules/commonjs/promise/core.js");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
Cu.import("resource://services-common/log4moz.js");
|
||||
Cu.import("resource://services-common/utils.js");
|
||||
Cu.import("resource://gre/modules/services/metrics/dataprovider.jsm");
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
#ifndef MERGED_COMPARTMENT
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"Measurement",
|
||||
"Provider",
|
||||
|
@ -11,6 +13,10 @@ this.EXPORTED_SYMBOLS = [
|
|||
|
||||
const {utils: Cu} = Components;
|
||||
|
||||
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
#endif
|
||||
|
||||
Cu.import("resource://gre/modules/commonjs/promise/core.js");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
Cu.import("resource://services-common/log4moz.js");
|
||||
|
@ -18,8 +24,6 @@ Cu.import("resource://services-common/preferences.js");
|
|||
Cu.import("resource://services-common/utils.js");
|
||||
|
||||
|
||||
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a collection of related pieces/fields of data.
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
#ifndef MERGED_COMPARTMENT
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"DailyValues",
|
||||
"MetricsStorageBackend",
|
||||
|
@ -13,6 +15,10 @@ this.EXPORTED_SYMBOLS = [
|
|||
|
||||
const {utils: Cu} = Components;
|
||||
|
||||
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
#endif
|
||||
|
||||
Cu.import("resource://gre/modules/commonjs/promise/core.js");
|
||||
Cu.import("resource://gre/modules/Sqlite.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
@ -20,8 +26,6 @@ Cu.import("resource://services-common/log4moz.js");
|
|||
Cu.import("resource://services-common/utils.js");
|
||||
|
||||
|
||||
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
// These do not account for leap seconds. Meh.
|
||||
function dateToDays(date) {
|
||||
return Math.floor(date.getTime() / MILLISECONDS_PER_DAY);
|
||||
|
|
|
@ -19,6 +19,8 @@ function run_test() {
|
|||
Components.utils.import(resource, {});
|
||||
}
|
||||
|
||||
Components.utils.import("resource://gre/modules/Metrics.jsm", {});
|
||||
|
||||
for (let m of test_modules) {
|
||||
let resource = "resource://testing-common/services/metrics/" + m;
|
||||
Components.utils.import(resource, {});
|
||||
|
|
Загрузка…
Ссылка в новой задаче