зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1513366: Part 2 - Update MemoryTelemetry to use do_ImportModule. r=erahm
It makes things much simpler. Differential Revision: https://phabricator.services.mozilla.com/D14210 --HG-- extra : rebase_source : cc49434f540a54f3993cea94707892af72b59bd6
This commit is contained in:
Родитель
3e8d266e8a
Коммит
3a49921a03
|
@ -8,7 +8,6 @@
|
|||
#include "nsMemoryReporterManager.h"
|
||||
|
||||
#include "GCTelemetry.h"
|
||||
#include "mozJSComponentLoader.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/Result.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
|
@ -25,6 +24,7 @@
|
|||
#include "nsIDOMChromeWindow.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsIWindowMediator.h"
|
||||
#include "nsImportModule.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsObserverService.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
@ -49,19 +49,11 @@ static constexpr const char* kTopicCycleCollectorBegin =
|
|||
static constexpr uint32_t kTotalMemoryCollectorTimeout = 200;
|
||||
|
||||
static Result<nsCOMPtr<mozIGCTelemetry>, nsresult> GetGCTelemetry() {
|
||||
AutoJSAPI jsapi;
|
||||
MOZ_ALWAYS_TRUE(jsapi.Init(xpc::PrivilegedJunkScope()));
|
||||
JSContext* cx = jsapi.cx();
|
||||
nsresult rv;
|
||||
|
||||
JS::RootedObject global(cx);
|
||||
JS::RootedObject exports(cx);
|
||||
MOZ_TRY(mozJSComponentLoader::Get()->Import(
|
||||
cx, NS_LITERAL_CSTRING("resource://gre/modules/GCTelemetry.jsm"), &global,
|
||||
&exports));
|
||||
|
||||
nsCOMPtr<mozIGCTelemetryJSM> jsm;
|
||||
MOZ_TRY(nsContentUtils::XPConnect()->WrapJS(
|
||||
cx, exports, NS_GET_IID(mozIGCTelemetryJSM), getter_AddRefs(jsm)));
|
||||
nsCOMPtr<mozIGCTelemetryJSM> jsm =
|
||||
do_ImportModule("resource://gre/modules/GCTelemetry.jsm", &rv);
|
||||
MOZ_TRY(rv);
|
||||
|
||||
nsCOMPtr<mozIGCTelemetry> gcTelemetry;
|
||||
MOZ_TRY(jsm->GetGCTelemetry(getter_AddRefs(gcTelemetry)));
|
||||
|
|
|
@ -219,7 +219,6 @@ FINAL_LIBRARY = 'xul'
|
|||
LOCAL_INCLUDES += [
|
||||
'../build',
|
||||
'/dom/base',
|
||||
'/js/xpconnect/loader', # for mozJSComponentLoader.h
|
||||
'/mfbt',
|
||||
'/xpcom/ds',
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче