From 7e52540256c774b44bc049e15f706042acf5dbe1 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Wed, 31 Jan 2018 08:24:59 +0100 Subject: [PATCH] Bug 1432963 - Fixing workers headers - part 16 - JSSettings in a workerinternals namespace, r=smaug --- caps/nsJSPrincipals.cpp | 4 +- dom/base/Navigator.cpp | 5 +- dom/base/nsGlobalWindowInner.cpp | 2 +- dom/base/nsGlobalWindowOuter.cpp | 2 +- dom/fetch/FetchDriver.cpp | 2 +- dom/fetch/InternalRequest.cpp | 4 +- dom/notification/NotificationEvent.h | 2 +- dom/push/PushSubscription.cpp | 2 +- dom/serviceworkers/ServiceWorkerEvents.h | 2 +- dom/serviceworkers/ServiceWorkerInfo.h | 2 +- dom/workers/JSSettings.h | 132 ++++++++++++ dom/workers/Principal.cpp | 2 +- dom/workers/Queue.h | 12 +- dom/workers/RuntimeService.cpp | 261 ++++++++++++----------- dom/workers/RuntimeService.h | 17 +- dom/workers/SharedWorker.cpp | 3 +- dom/workers/SharedWorker.h | 4 +- dom/workers/WorkerCommon.h | 112 ---------- dom/workers/WorkerDebugger.h | 2 +- dom/workers/WorkerDebuggerManager.h | 2 +- dom/workers/WorkerHolder.h | 2 +- dom/workers/WorkerLoadInfo.h | 2 +- dom/workers/WorkerNavigator.h | 2 +- dom/workers/WorkerPrivate.cpp | 77 +++---- dom/workers/WorkerPrivate.h | 13 +- dom/workers/WorkerRunnable.h | 2 +- dom/workers/WorkerScope.h | 2 +- dom/workers/WorkerThread.h | 4 +- dom/workers/moz.build | 6 +- 29 files changed, 360 insertions(+), 324 deletions(-) create mode 100644 dom/workers/JSSettings.h diff --git a/caps/nsJSPrincipals.cpp b/caps/nsJSPrincipals.cpp index 1fbd61da9ebf..118bbe2f9f07 100644 --- a/caps/nsJSPrincipals.cpp +++ b/caps/nsJSPrincipals.cpp @@ -16,7 +16,7 @@ #include "mozilla/dom/StructuredCloneTags.h" // for mozilla::dom::workers::kJSPrincipalsDebugToken -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/workerinternals/JSSettings.h" #include "mozilla/ipc/BackgroundUtils.h" using namespace mozilla; @@ -90,7 +90,7 @@ JSPrincipals::dump() nsresult rv = static_cast(this)->GetScriptLocation(str); fprintf(stderr, "nsIPrincipal (%p) = %s\n", static_cast(this), NS_SUCCEEDED(rv) ? str.get() : "(unknown)"); - } else if (debugToken == dom::workers::kJSPrincipalsDebugToken) { + } else if (debugToken == dom::workerinternals::kJSPrincipalsDebugToken) { fprintf(stderr, "Web Worker principal singleton (%p)\n", this); } else { fprintf(stderr, diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index bc5d4bb4ace3..261fbb7626b2 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -45,7 +45,7 @@ #include "mozilla/dom/VRDisplay.h" #include "mozilla/dom/VRDisplayEvent.h" #include "mozilla/dom/VRServiceTest.h" -#include "mozilla/dom/workers/RuntimeService.h" +#include "mozilla/dom/workerinternals/RuntimeService.h" #include "mozilla/Hal.h" #include "mozilla/ClearOnShutdown.h" #include "mozilla/StaticPtr.h" @@ -692,7 +692,8 @@ Navigator::JavaEnabled(CallerType aCallerType, ErrorResult& aRv) uint64_t Navigator::HardwareConcurrency() { - workers::RuntimeService* rts = workers::RuntimeService::GetOrCreateService(); + workerinternals::RuntimeService* rts = + workerinternals::RuntimeService::GetOrCreateService(); if (!rts) { return 1; } diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index 07e0a4057ef8..c4a46847a4f6 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -82,7 +82,7 @@ #include "nsContentCID.h" #include "nsLayoutStatics.h" #include "nsCCUncollectableMarker.h" -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/dom/ToJSValue.h" #include "nsJSPrincipals.h" #include "mozilla/Attributes.h" diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index d2cc1d5e9e2b..d08167aaecc0 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -80,7 +80,7 @@ #include "nsContentCID.h" #include "nsLayoutStatics.h" #include "nsCCUncollectableMarker.h" -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/dom/ToJSValue.h" #include "nsJSPrincipals.h" #include "mozilla/Attributes.h" diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp index abde69e02790..0d8d8944f623 100644 --- a/dom/fetch/FetchDriver.cpp +++ b/dom/fetch/FetchDriver.cpp @@ -32,7 +32,7 @@ #include "mozilla/dom/File.h" #include "mozilla/dom/PerformanceStorage.h" -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/EventStateManager.h" #include "mozilla/ipc/PBackgroundSharedTypes.h" #include "mozilla/Unused.h" diff --git a/dom/fetch/InternalRequest.cpp b/dom/fetch/InternalRequest.cpp index 330e7a994884..ab68913179f4 100644 --- a/dom/fetch/InternalRequest.cpp +++ b/dom/fetch/InternalRequest.cpp @@ -13,9 +13,9 @@ #include "mozilla/ErrorResult.h" #include "mozilla/dom/FetchTypes.h" #include "mozilla/dom/ScriptSettings.h" -#include "mozilla/dom/workers/WorkerCommon.h" -#include "WorkerPrivate.h" +#include "mozilla/dom/WorkerCommon.h" +#include "mozilla/dom/WorkerPrivate.h" namespace mozilla { namespace dom { diff --git a/dom/notification/NotificationEvent.h b/dom/notification/NotificationEvent.h index 58c45b7de82f..f2aa5211afeb 100644 --- a/dom/notification/NotificationEvent.h +++ b/dom/notification/NotificationEvent.h @@ -10,7 +10,7 @@ #include "mozilla/dom/Event.h" #include "mozilla/dom/NotificationEventBinding.h" #include "mozilla/dom/ServiceWorkerEvents.h" -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" namespace mozilla { namespace dom { diff --git a/dom/push/PushSubscription.cpp b/dom/push/PushSubscription.cpp index 9a65a272aa8e..dae636c99953 100644 --- a/dom/push/PushSubscription.cpp +++ b/dom/push/PushSubscription.cpp @@ -16,9 +16,9 @@ #include "mozilla/dom/PromiseWorkerProxy.h" #include "mozilla/dom/PushSubscriptionOptions.h" #include "mozilla/dom/PushUtil.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/dom/WorkerPrivate.h" #include "mozilla/dom/WorkerScope.h" -#include "mozilla/dom/workers/WorkerCommon.h" namespace mozilla { namespace dom { diff --git a/dom/serviceworkers/ServiceWorkerEvents.h b/dom/serviceworkers/ServiceWorkerEvents.h index 6eff95dfeb8d..49f5c6e5fc04 100644 --- a/dom/serviceworkers/ServiceWorkerEvents.h +++ b/dom/serviceworkers/ServiceWorkerEvents.h @@ -15,7 +15,7 @@ #include "mozilla/dom/File.h" #include "mozilla/dom/Promise.h" #include "mozilla/dom/Response.h" -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "nsProxyRelease.h" #include "nsContentUtils.h" diff --git a/dom/serviceworkers/ServiceWorkerInfo.h b/dom/serviceworkers/ServiceWorkerInfo.h index 3f6f15a7a454..05b4fef46bc6 100644 --- a/dom/serviceworkers/ServiceWorkerInfo.h +++ b/dom/serviceworkers/ServiceWorkerInfo.h @@ -9,7 +9,7 @@ #include "MainThreadUtils.h" #include "mozilla/dom/ServiceWorkerBinding.h" // For ServiceWorkerState -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/OriginAttributes.h" #include "nsIServiceWorkerManager.h" diff --git a/dom/workers/JSSettings.h b/dom/workers/JSSettings.h new file mode 100644 index 000000000000..8d8c7986bec0 --- /dev/null +++ b/dom/workers/JSSettings.h @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef mozilla_dom_workerinternals_JSSettings_h +#define mozilla_dom_workerinternals_JSSettings_h + +#include "jsapi.h" +#include "mozilla/Maybe.h" +#include "nsString.h" +#include "nsTArray.h" + +namespace mozilla { +namespace dom { +namespace workerinternals { + +// Random unique constant to facilitate JSPrincipal debugging +const uint32_t kJSPrincipalsDebugToken = 0x7e2df9d2; + +struct JSSettings +{ + enum { + // All the GC parameters that we support. + JSSettings_JSGC_MAX_BYTES = 0, + JSSettings_JSGC_MAX_MALLOC_BYTES, + JSSettings_JSGC_HIGH_FREQUENCY_TIME_LIMIT, + JSSettings_JSGC_LOW_FREQUENCY_HEAP_GROWTH, + JSSettings_JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN, + JSSettings_JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX, + JSSettings_JSGC_HIGH_FREQUENCY_LOW_LIMIT, + JSSettings_JSGC_HIGH_FREQUENCY_HIGH_LIMIT, + JSSettings_JSGC_ALLOCATION_THRESHOLD, + JSSettings_JSGC_SLICE_TIME_BUDGET, + JSSettings_JSGC_DYNAMIC_HEAP_GROWTH, + JSSettings_JSGC_DYNAMIC_MARK_SLICE, + // JSGC_MODE not supported + + // This must be last so that we get an accurate count. + kGCSettingsArraySize + }; + + struct JSGCSetting + { + mozilla::Maybe key; + uint32_t value; + + JSGCSetting() + : key(), value(0) + { } + }; + + // There are several settings that we know we need so it makes sense to + // preallocate here. + typedef JSGCSetting JSGCSettingsArray[kGCSettingsArraySize]; + + // Settings that change based on chrome/content context. + struct JSContentChromeSettings + { + JS::CompartmentOptions compartmentOptions; + int32_t maxScriptRuntime; + + JSContentChromeSettings() + : compartmentOptions(), maxScriptRuntime(0) + { } + }; + + JSContentChromeSettings chrome; + JSContentChromeSettings content; + JSGCSettingsArray gcSettings; + JS::ContextOptions contextOptions; + +#ifdef JS_GC_ZEAL + uint8_t gcZeal; + uint32_t gcZealFrequency; +#endif + + JSSettings() +#ifdef JS_GC_ZEAL + : gcZeal(0), gcZealFrequency(0) +#endif + { + for (uint32_t index = 0; index < ArrayLength(gcSettings); index++) { + new (gcSettings + index) JSGCSetting(); + } + } + + bool + ApplyGCSetting(JSGCParamKey aKey, uint32_t aValue) + { + JSSettings::JSGCSetting* firstEmptySetting = nullptr; + JSSettings::JSGCSetting* foundSetting = nullptr; + + for (uint32_t index = 0; index < ArrayLength(gcSettings); index++) { + JSSettings::JSGCSetting& setting = gcSettings[index]; + if (setting.key.isSome() && *setting.key == aKey) { + foundSetting = &setting; + break; + } + if (!firstEmptySetting && setting.key.isNothing()) { + firstEmptySetting = &setting; + } + } + + if (aValue) { + if (!foundSetting) { + foundSetting = firstEmptySetting; + if (!foundSetting) { + NS_ERROR("Not enough space for this value!"); + return false; + } + } + foundSetting->key = mozilla::Some(aKey); + foundSetting->value = aValue; + return true; + } + + if (foundSetting) { + foundSetting->key.reset(); + return true; + } + + return false; + } +}; + +} // workerinternals namespace +} // dom namespace +} // mozilla namespace + +#endif // mozilla_dom_workerinternals_JSSettings_h diff --git a/dom/workers/Principal.cpp b/dom/workers/Principal.cpp index e7407e03347c..245cf04f452a 100644 --- a/dom/workers/Principal.cpp +++ b/dom/workers/Principal.cpp @@ -36,7 +36,7 @@ GetWorkerPrincipal() --sPrincipal.refcount; } else { #ifdef DEBUG - sPrincipal.debugToken = workers::kJSPrincipalsDebugToken; + sPrincipal.debugToken = workerinternals::kJSPrincipalsDebugToken; #endif } diff --git a/dom/workers/Queue.h b/dom/workers/Queue.h index 7d374d21bdaf..a3a23c135cd4 100644 --- a/dom/workers/Queue.h +++ b/dom/workers/Queue.h @@ -4,17 +4,17 @@ * 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/. */ -#ifndef mozilla_dom_workers_queue_h__ -#define mozilla_dom_workers_queue_h__ +#ifndef mozilla_dom_workerinternal_Queue_h +#define mozilla_dom_workerinternal_Queue_h -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/Mutex.h" #include "nsTArray.h" namespace mozilla { namespace dom { -namespace workersinternals { +namespace workerinternals { template struct StorageWithTArray @@ -200,8 +200,8 @@ private: Queue & operator=(const Queue&); }; -} // workersinternals namespace +} // workerinternals namespace } // dom namespace } // mozilla namespace -#endif /* mozilla_dom_workers_queue_h__ */ +#endif /* mozilla_dom_workerinternals_Queue_h*/ diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index ae46bcb9e471..151b9e4c2ba0 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -83,7 +83,11 @@ namespace mozilla { using namespace ipc; namespace dom { -namespace workers { + +using namespace workers; +using namespace workerinternals; + +namespace workerinternals { // The size of the worker runtime heaps in bytes. May be changed via pref. #define WORKER_DEFAULT_RUNTIME_HEAPSIZE 32 * 1024 * 1024 @@ -1251,131 +1255,6 @@ PlatformOverrideChanged(const char* /* aPrefName */, void* /* aClosure */) } /* anonymous namespace */ -void -CancelWorkersForWindow(nsPIDOMWindowInner* aWindow) -{ - AssertIsOnMainThread(); - RuntimeService* runtime = RuntimeService::GetService(); - if (runtime) { - runtime->CancelWorkersForWindow(aWindow); - } -} - -void -FreezeWorkersForWindow(nsPIDOMWindowInner* aWindow) -{ - AssertIsOnMainThread(); - RuntimeService* runtime = RuntimeService::GetService(); - if (runtime) { - runtime->FreezeWorkersForWindow(aWindow); - } -} - -void -ThawWorkersForWindow(nsPIDOMWindowInner* aWindow) -{ - AssertIsOnMainThread(); - RuntimeService* runtime = RuntimeService::GetService(); - if (runtime) { - runtime->ThawWorkersForWindow(aWindow); - } -} - -void -SuspendWorkersForWindow(nsPIDOMWindowInner* aWindow) -{ - AssertIsOnMainThread(); - RuntimeService* runtime = RuntimeService::GetService(); - if (runtime) { - runtime->SuspendWorkersForWindow(aWindow); - } -} - -void -ResumeWorkersForWindow(nsPIDOMWindowInner* aWindow) -{ - AssertIsOnMainThread(); - RuntimeService* runtime = RuntimeService::GetService(); - if (runtime) { - runtime->ResumeWorkersForWindow(aWindow); - } -} - -WorkerPrivate* -GetWorkerPrivateFromContext(JSContext* aCx) -{ - MOZ_ASSERT(!NS_IsMainThread()); - MOZ_ASSERT(aCx); - - void* cxPrivate = JS_GetContextPrivate(aCx); - if (!cxPrivate) { - return nullptr; - } - - return - static_cast(cxPrivate)->GetWorkerPrivate(); -} - -WorkerPrivate* -GetCurrentThreadWorkerPrivate() -{ - MOZ_ASSERT(!NS_IsMainThread()); - - CycleCollectedJSContext* ccjscx = CycleCollectedJSContext::Get(); - if (!ccjscx) { - return nullptr; - } - - JSContext* cx = ccjscx->Context(); - MOZ_ASSERT(cx); - - // Note that we can return nullptr if the nsCycleCollector_shutdown() in - // ~WorkerJSContext() triggers any calls to GetCurrentThreadWorkerPrivate(). - // At this stage CycleCollectedJSContext::Get() will still return a context, - // but the context private has already been cleared. - return GetWorkerPrivateFromContext(cx); -} - -bool -IsCurrentThreadRunningChromeWorker() -{ - return GetCurrentThreadWorkerPrivate()->UsesSystemPrincipal(); -} - -JSContext* -GetCurrentThreadJSContext() -{ - WorkerPrivate* wp = GetCurrentThreadWorkerPrivate(); - if (!wp) { - return nullptr; - } - return wp->GetJSContext(); -} - -JSObject* -GetCurrentThreadWorkerGlobal() -{ - WorkerPrivate* wp = GetCurrentThreadWorkerPrivate(); - if (!wp) { - return nullptr; - } - WorkerGlobalScope* scope = wp->GlobalScope(); - if (!scope) { - return nullptr; - } - return scope->GetGlobalJSObject(); -} - -#ifdef DEBUG - -void -AssertIsOnMainThread() -{ - MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!"); -} - -#endif - struct RuntimeService::IdleThreadInfo { RefPtr mThread; @@ -2931,6 +2810,136 @@ WorkerThreadPrimaryRunnable::FinishedRunnable::Run() return NS_OK; } +} // workerinternals namespace + +namespace workers { + +void +CancelWorkersForWindow(nsPIDOMWindowInner* aWindow) +{ + AssertIsOnMainThread(); + RuntimeService* runtime = RuntimeService::GetService(); + if (runtime) { + runtime->CancelWorkersForWindow(aWindow); + } +} + +void +FreezeWorkersForWindow(nsPIDOMWindowInner* aWindow) +{ + AssertIsOnMainThread(); + RuntimeService* runtime = RuntimeService::GetService(); + if (runtime) { + runtime->FreezeWorkersForWindow(aWindow); + } +} + +void +ThawWorkersForWindow(nsPIDOMWindowInner* aWindow) +{ + AssertIsOnMainThread(); + RuntimeService* runtime = RuntimeService::GetService(); + if (runtime) { + runtime->ThawWorkersForWindow(aWindow); + } +} + +void +SuspendWorkersForWindow(nsPIDOMWindowInner* aWindow) +{ + AssertIsOnMainThread(); + RuntimeService* runtime = RuntimeService::GetService(); + if (runtime) { + runtime->SuspendWorkersForWindow(aWindow); + } +} + +void +ResumeWorkersForWindow(nsPIDOMWindowInner* aWindow) +{ + AssertIsOnMainThread(); + RuntimeService* runtime = RuntimeService::GetService(); + if (runtime) { + runtime->ResumeWorkersForWindow(aWindow); + } +} + +WorkerPrivate* +GetWorkerPrivateFromContext(JSContext* aCx) +{ + MOZ_ASSERT(!NS_IsMainThread()); + MOZ_ASSERT(aCx); + + void* cxPrivate = JS_GetContextPrivate(aCx); + if (!cxPrivate) { + return nullptr; + } + + return + static_cast(cxPrivate)->GetWorkerPrivate(); +} + +WorkerPrivate* +GetCurrentThreadWorkerPrivate() +{ + MOZ_ASSERT(!NS_IsMainThread()); + + CycleCollectedJSContext* ccjscx = CycleCollectedJSContext::Get(); + if (!ccjscx) { + return nullptr; + } + + JSContext* cx = ccjscx->Context(); + MOZ_ASSERT(cx); + + // Note that we can return nullptr if the nsCycleCollector_shutdown() in + // ~WorkerJSContext() triggers any calls to GetCurrentThreadWorkerPrivate(). + // At this stage CycleCollectedJSContext::Get() will still return a context, + // but the context private has already been cleared. + return GetWorkerPrivateFromContext(cx); +} + +bool +IsCurrentThreadRunningChromeWorker() +{ + return GetCurrentThreadWorkerPrivate()->UsesSystemPrincipal(); +} + +JSContext* +GetCurrentThreadJSContext() +{ + WorkerPrivate* wp = GetCurrentThreadWorkerPrivate(); + if (!wp) { + return nullptr; + } + return wp->GetJSContext(); +} + +JSObject* +GetCurrentThreadWorkerGlobal() +{ + WorkerPrivate* wp = GetCurrentThreadWorkerPrivate(); + if (!wp) { + return nullptr; + } + WorkerGlobalScope* scope = wp->GlobalScope(); + if (!scope) { + return nullptr; + } + return scope->GetGlobalJSObject(); +} + +#ifdef DEBUG + +void +AssertIsOnMainThread() +{ + MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!"); +} + +#endif + } // workers namespace + } // dom namespace } // mozilla namespace diff --git a/dom/workers/RuntimeService.h b/dom/workers/RuntimeService.h index e032d00f9c7b..2c36a7815d53 100644 --- a/dom/workers/RuntimeService.h +++ b/dom/workers/RuntimeService.h @@ -12,6 +12,7 @@ #include "nsIObserver.h" #include "mozilla/dom/BindingDeclarations.h" +#include "mozilla/dom/workerinternals/JSSettings.h" #include "nsClassHashtable.h" #include "nsHashKeys.h" #include "nsTArray.h" @@ -25,7 +26,7 @@ class SharedWorker; struct WorkerLoadInfo; class WorkerThread; -namespace workers { +namespace workerinternals { class RuntimeService final : public nsIObserver { @@ -93,7 +94,7 @@ class RuntimeService final : public nsIObserver // Only used on the main thread. nsCOMPtr mIdleThreadTimer; - static JSSettings sDefaultJSSettings; + static workerinternals::JSSettings sDefaultJSSettings; public: struct NavigatorProperties @@ -169,16 +170,16 @@ public: NoteIdleThread(WorkerThread* aThread); static void - GetDefaultJSSettings(JSSettings& aSettings) + GetDefaultJSSettings(workerinternals::JSSettings& aSettings) { - AssertIsOnMainThread(); + workers::AssertIsOnMainThread(); aSettings = sDefaultJSSettings; } static void SetDefaultContextOptions(const JS::ContextOptions& aContextOptions) { - AssertIsOnMainThread(); + workers::AssertIsOnMainThread(); sDefaultJSSettings.contextOptions = aContextOptions; } @@ -200,7 +201,7 @@ public: static void SetDefaultJSGCSettings(JSGCParamKey aKey, uint32_t aValue) { - AssertIsOnMainThread(); + workers::AssertIsOnMainThread(); sDefaultJSSettings.ApplyGCSetting(aKey, aValue); } @@ -211,7 +212,7 @@ public: static void SetDefaultGCZeal(uint8_t aGCZeal, uint32_t aFrequency) { - AssertIsOnMainThread(); + workers::AssertIsOnMainThread(); sDefaultJSSettings.gcZeal = aGCZeal; sDefaultJSSettings.gcZealFrequency = aFrequency; } @@ -270,7 +271,7 @@ private: SharedWorker** aSharedWorker); }; -} // workers namespace +} // workerinternals namespace } // dom namespace } // mozilla namespace diff --git a/dom/workers/SharedWorker.cpp b/dom/workers/SharedWorker.cpp index e88ba7d40320..22af5346decb 100644 --- a/dom/workers/SharedWorker.cpp +++ b/dom/workers/SharedWorker.cpp @@ -58,7 +58,8 @@ SharedWorker::Constructor(const GlobalObject& aGlobal, { AssertIsOnMainThread(); - workers::RuntimeService* rts = workers::RuntimeService::GetOrCreateService(); + workerinternals::RuntimeService* rts = + workerinternals::RuntimeService::GetOrCreateService(); if (!rts) { aRv = NS_ERROR_NOT_AVAILABLE; return nullptr; diff --git a/dom/workers/SharedWorker.h b/dom/workers/SharedWorker.h index 26e2f4e84019..20234af96784 100644 --- a/dom/workers/SharedWorker.h +++ b/dom/workers/SharedWorker.h @@ -27,13 +27,13 @@ class MessagePort; class StringOrWorkerOptions; class WorkerPrivate; -namespace workers { +namespace workerinternals { class RuntimeService; } class SharedWorker final : public DOMEventTargetHelper { - friend class workers::RuntimeService; + friend class workerinternals::RuntimeService; typedef mozilla::ErrorResult ErrorResult; typedef mozilla::dom::GlobalObject GlobalObject; diff --git a/dom/workers/WorkerCommon.h b/dom/workers/WorkerCommon.h index f21df5fcc184..b8fb44074415 100644 --- a/dom/workers/WorkerCommon.h +++ b/dom/workers/WorkerCommon.h @@ -37,115 +37,6 @@ class WorkerPrivate; namespace workers { -struct PrivatizableBase -{ }; - -struct JSSettings -{ - enum { - // All the GC parameters that we support. - JSSettings_JSGC_MAX_BYTES = 0, - JSSettings_JSGC_MAX_MALLOC_BYTES, - JSSettings_JSGC_HIGH_FREQUENCY_TIME_LIMIT, - JSSettings_JSGC_LOW_FREQUENCY_HEAP_GROWTH, - JSSettings_JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN, - JSSettings_JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX, - JSSettings_JSGC_HIGH_FREQUENCY_LOW_LIMIT, - JSSettings_JSGC_HIGH_FREQUENCY_HIGH_LIMIT, - JSSettings_JSGC_ALLOCATION_THRESHOLD, - JSSettings_JSGC_SLICE_TIME_BUDGET, - JSSettings_JSGC_DYNAMIC_HEAP_GROWTH, - JSSettings_JSGC_DYNAMIC_MARK_SLICE, - // JSGC_MODE not supported - - // This must be last so that we get an accurate count. - kGCSettingsArraySize - }; - - struct JSGCSetting - { - mozilla::Maybe key; - uint32_t value; - - JSGCSetting() - : key(), value(0) - { } - }; - - // There are several settings that we know we need so it makes sense to - // preallocate here. - typedef JSGCSetting JSGCSettingsArray[kGCSettingsArraySize]; - - // Settings that change based on chrome/content context. - struct JSContentChromeSettings - { - JS::CompartmentOptions compartmentOptions; - int32_t maxScriptRuntime; - - JSContentChromeSettings() - : compartmentOptions(), maxScriptRuntime(0) - { } - }; - - JSContentChromeSettings chrome; - JSContentChromeSettings content; - JSGCSettingsArray gcSettings; - JS::ContextOptions contextOptions; - -#ifdef JS_GC_ZEAL - uint8_t gcZeal; - uint32_t gcZealFrequency; -#endif - - JSSettings() -#ifdef JS_GC_ZEAL - : gcZeal(0), gcZealFrequency(0) -#endif - { - for (uint32_t index = 0; index < ArrayLength(gcSettings); index++) { - new (gcSettings + index) JSGCSetting(); - } - } - - bool - ApplyGCSetting(JSGCParamKey aKey, uint32_t aValue) - { - JSSettings::JSGCSetting* firstEmptySetting = nullptr; - JSSettings::JSGCSetting* foundSetting = nullptr; - - for (uint32_t index = 0; index < ArrayLength(gcSettings); index++) { - JSSettings::JSGCSetting& setting = gcSettings[index]; - if (setting.key.isSome() && *setting.key == aKey) { - foundSetting = &setting; - break; - } - if (!firstEmptySetting && setting.key.isNothing()) { - firstEmptySetting = &setting; - } - } - - if (aValue) { - if (!foundSetting) { - foundSetting = firstEmptySetting; - if (!foundSetting) { - NS_ERROR("Not enough space for this value!"); - return false; - } - } - foundSetting->key = mozilla::Some(aKey); - foundSetting->value = aValue; - return true; - } - - if (foundSetting) { - foundSetting->key.reset(); - return true; - } - - return false; - } -}; - // All of these are implemented in RuntimeService.cpp #ifdef DEBUG @@ -198,9 +89,6 @@ IsDebuggerGlobal(JSObject* global); bool IsDebuggerSandbox(JSObject* object); -// Random unique constant to facilitate JSPrincipal debugging -const uint32_t kJSPrincipalsDebugToken = 0x7e2df9d2; - } // workers namespace } // dom namespace } // mozilla namespace diff --git a/dom/workers/WorkerDebugger.h b/dom/workers/WorkerDebugger.h index 69fc7e54288e..5d3832b7dfd7 100644 --- a/dom/workers/WorkerDebugger.h +++ b/dom/workers/WorkerDebugger.h @@ -7,7 +7,7 @@ #ifndef mozilla_dom_workers_WorkerDebugger_h #define mozilla_dom_workers_WorkerDebugger_h -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "nsIWorkerDebugger.h" namespace mozilla { diff --git a/dom/workers/WorkerDebuggerManager.h b/dom/workers/WorkerDebuggerManager.h index 00591d0f91b5..e46654b77345 100644 --- a/dom/workers/WorkerDebuggerManager.h +++ b/dom/workers/WorkerDebuggerManager.h @@ -7,7 +7,7 @@ #ifndef mozilla_dom_workers_workerdebuggermanager_h #define mozilla_dom_workers_workerdebuggermanager_h -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "nsIObserver.h" #include "nsIWorkerDebuggerManager.h" diff --git a/dom/workers/WorkerHolder.h b/dom/workers/WorkerHolder.h index e77ad6c54f1a..f9819606311a 100644 --- a/dom/workers/WorkerHolder.h +++ b/dom/workers/WorkerHolder.h @@ -7,7 +7,7 @@ #ifndef mozilla_dom_workers_WorkerHolder_h #define mozilla_dom_workers_WorkerHolder_h -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" namespace mozilla { namespace dom { diff --git a/dom/workers/WorkerLoadInfo.h b/dom/workers/WorkerLoadInfo.h index cc9213f441f6..3569c5513b23 100644 --- a/dom/workers/WorkerLoadInfo.h +++ b/dom/workers/WorkerLoadInfo.h @@ -8,7 +8,7 @@ #define mozilla_dom_workers_WorkerLoadInfo_h #include "mozilla/dom/ChannelInfo.h" -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/net/ReferrerPolicy.h" #include "nsIInterfaceRequestor.h" #include "nsILoadContext.h" diff --git a/dom/workers/WorkerNavigator.h b/dom/workers/WorkerNavigator.h index 0e9c2fbfef5c..8bc1b08d8200 100644 --- a/dom/workers/WorkerNavigator.h +++ b/dom/workers/WorkerNavigator.h @@ -25,7 +25,7 @@ class Connection; class WorkerNavigator final : public nsWrapperCache { - typedef struct workers::RuntimeService::NavigatorProperties NavigatorProperties; + typedef struct workerinternals::RuntimeService::NavigatorProperties NavigatorProperties; NavigatorProperties mProperties; RefPtr mStorageManager; diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index ed1425a84592..8b60955dd9b5 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -95,6 +95,7 @@ TimeoutsLog() using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::dom::workers; +using namespace mozilla::dom::workerinternals; using namespace mozilla::ipc; MOZ_DEFINE_MALLOC_SIZE_OF(JsWorkerMallocSizeOf) @@ -241,7 +242,7 @@ private: NS_WARNING("Failed to dispatch, going to leak!"); } - workers::RuntimeService* runtime = workers::RuntimeService::GetService(); + RuntimeService* runtime = RuntimeService::GetService(); NS_ASSERTION(runtime, "This should never be null!"); mFinishedWorker->DisableDebugger(); @@ -273,9 +274,9 @@ private: NS_IMETHOD Run() override { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); - workers::RuntimeService* runtime = workers::RuntimeService::GetService(); + RuntimeService* runtime = RuntimeService::GetService(); MOZ_ASSERT(runtime); mFinishedWorker->DisableDebugger(); @@ -555,7 +556,7 @@ public: if (aWorkerPrivate) { aWorkerPrivate->AssertIsOnWorkerThread(); } else { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); } // Now fire a runnable to do the same on the parent's thread if we can. @@ -1213,7 +1214,7 @@ private: ~FinishCollectRunnable() { // mHandleReport and mHandlerData are released on the main thread. - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); } FinishCollectRunnable(const FinishCollectRunnable&) = delete; @@ -1247,7 +1248,7 @@ WorkerPrivate::MemoryReporter::CollectReports(nsIHandleReportCallback* aHandleRe nsISupports* aData, bool aAnonymize) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); RefPtr runnable; @@ -1299,7 +1300,7 @@ WorkerPrivate::MemoryReporter::CollectReports(nsIHandleReportCallback* aHandleRe void WorkerPrivate::MemoryReporter::TryToMapAddon(nsACString &path) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); mMutex.AssertCurrentThreadOwns(); if (mAlreadyMappedToAddon || !mWorkerPrivate) { @@ -1388,7 +1389,7 @@ WorkerPrivate::MemoryReporter::FinishCollectRunnable::FinishCollectRunnable( NS_IMETHODIMP WorkerPrivate::MemoryReporter::FinishCollectRunnable::Run() { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); nsCOMPtr manager = do_GetService("@mozilla.org/memory-reporter-manager;1"); @@ -1441,7 +1442,7 @@ template nsIDocument* WorkerPrivateParent::GetDocument() const { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); if (mLoadInfo.mWindow) { return mLoadInfo.mWindow->GetExtantDoc(); } @@ -1462,7 +1463,7 @@ template void WorkerPrivateParent::SetCSP(nsIContentSecurityPolicy* aCSP) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); if (!aCSP) { return; } @@ -1476,7 +1477,7 @@ nsresult WorkerPrivateParent::SetCSPFromHeaderValues(const nsACString& aCSPHeaderValue, const nsACString& aCSPReportOnlyHeaderValue) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); MOZ_DIAGNOSTIC_ASSERT(!mLoadInfo.mCSP); NS_ConvertASCIItoUTF16 cspHeaderValue(aCSPHeaderValue); @@ -1576,7 +1577,7 @@ WorkerPrivateParent::WorkerPrivateParent( MOZ_ASSERT_IF(!IsDedicatedWorker(), NS_IsMainThread()); if (aLoadInfo.mWindow) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); BindToOwner(aLoadInfo.mWindow); } @@ -1600,9 +1601,9 @@ WorkerPrivateParent::WorkerPrivateParent( } } else { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); - workers::RuntimeService::GetDefaultJSSettings(mJSSettings); + RuntimeService::GetDefaultJSSettings(mJSSettings); // Our secure context state depends on the kind of worker we have. if (UsesSystemPrincipal() || IsServiceWorker()) { @@ -1866,7 +1867,7 @@ WorkerPrivateParent::NotifyPrivate(WorkerStatus aStatus) } if (IsSharedWorker()) { - workers::RuntimeService* runtime = workers::RuntimeService::GetService(); + RuntimeService* runtime = RuntimeService::GetService(); MOZ_ASSERT(runtime); runtime->ForgetSharedWorker(ParentAsWorkerPrivate()); @@ -1914,7 +1915,7 @@ WorkerPrivateParent::Freeze(nsPIDOMWindowInner* aWindow) // frozen. It can happen that mSharedWorkers is empty but this thread has // not been unregistered yet. if ((IsSharedWorker() || IsServiceWorker()) && !mSharedWorkers.IsEmpty()) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); bool allFrozen = true; @@ -1973,7 +1974,7 @@ WorkerPrivateParent::Thaw(nsPIDOMWindowInner* aWindow) // It can happen that mSharedWorkers is empty but this thread has not been // unregistered yet. if ((IsSharedWorker() || IsServiceWorker()) && !mSharedWorkers.IsEmpty()) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); bool anyRunning = false; @@ -2040,7 +2041,7 @@ template void WorkerPrivateParent::ParentWindowPaused() { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); MOZ_ASSERT_IF(IsDedicatedWorker(), mParentWindowPausedDepth == 0); mParentWindowPausedDepth += 1; } @@ -2049,7 +2050,7 @@ template void WorkerPrivateParent::ParentWindowResumed() { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); MOZ_ASSERT(mParentWindowPausedDepth > 0); MOZ_ASSERT_IF(IsDedicatedWorker(), mParentWindowPausedDepth == 1); @@ -2385,7 +2386,7 @@ bool WorkerPrivateParent::RegisterSharedWorker(SharedWorker* aSharedWorker, MessagePort* aPort) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); MOZ_ASSERT(aSharedWorker); MOZ_ASSERT(IsSharedWorker()); MOZ_ASSERT(!mSharedWorkers.Contains(aSharedWorker)); @@ -2416,7 +2417,7 @@ WorkerPrivateParent::BroadcastErrorToSharedWorkers( const WorkerErrorReport* aReport, bool aIsErrorEvent) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); if (aIsErrorEvent && JSREPORT_IS_WARNING(aReport->mFlags)) { // Don't fire any events anywhere. Just log to console. @@ -2550,7 +2551,7 @@ void WorkerPrivateParent::GetAllSharedWorkers( nsTArray>& aSharedWorkers) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); MOZ_ASSERT(IsSharedWorker() || IsServiceWorker()); if (!aSharedWorkers.IsEmpty()) { @@ -2567,7 +2568,7 @@ void WorkerPrivateParent::CloseSharedWorkersForWindow( nsPIDOMWindowInner* aWindow) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); MOZ_ASSERT(IsSharedWorker() || IsServiceWorker()); MOZ_ASSERT(aWindow); @@ -2604,7 +2605,7 @@ template void WorkerPrivateParent::CloseAllSharedWorkers() { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); MOZ_ASSERT(IsSharedWorker() || IsServiceWorker()); for (uint32_t i = 0; i < mSharedWorkers.Length(); ++i) { @@ -2620,7 +2621,7 @@ template void WorkerPrivateParent::WorkerScriptLoaded() { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); if (IsSharedWorker() || IsServiceWorker()) { // No longer need to hold references to the window or document we came from. @@ -2633,7 +2634,7 @@ template void WorkerPrivateParent::SetBaseURI(nsIURI* aBaseURI) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); if (!mLoadInfo.mBaseURI) { NS_ASSERTION(GetParent(), "Shouldn't happen without a parent!"); @@ -2727,7 +2728,7 @@ template void WorkerPrivateParent::UpdateOverridenLoadGroup(nsILoadGroup* aBaseLoadGroup) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); // The load group should have been overriden at init time. mLoadInfo.mInterfaceRequestor->MaybeAddTabChild(aBaseLoadGroup); @@ -2738,7 +2739,7 @@ void WorkerPrivateParent::FlushReportsToSharedWorkers( nsIConsoleReportCollector* aReporter) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); AutoTArray, 10> sharedWorkers; AutoTArray windowActions; @@ -2831,7 +2832,7 @@ WorkerPrivateParent::AssertIsOnParentThread() const GetParent()->AssertIsOnWorkerThread(); } else { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); } } @@ -2846,7 +2847,7 @@ WorkerPrivateParent::AssertInnerWindowIsCorrect() const return; } - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); nsPIDOMWindowOuter* outer = mLoadInfo.mWindow->GetOuterWindow(); NS_ASSERTION(outer && outer->GetCurrentInnerWindow() == mLoadInfo.mWindow, @@ -2904,7 +2905,7 @@ WorkerPrivate::WorkerPrivate(WorkerPrivate* aParent, mOnLine = aParent->OnLine(); } else { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); mOnLine = !NS_IsOffline(); } @@ -3048,7 +3049,7 @@ WorkerPrivate::Constructor(JSContext* aCx, return nullptr; } } else { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); } Maybe stackLoadInfo; @@ -3070,17 +3071,17 @@ WorkerPrivate::Constructor(JSContext* aCx, // NB: This has to be done before creating the WorkerPrivate, because it will // attempt to use static variables that are initialized in the RuntimeService // constructor. - workers::RuntimeService* runtimeService; + RuntimeService* runtimeService; if (!parent) { - runtimeService = workers::RuntimeService::GetOrCreateService(); + runtimeService = RuntimeService::GetOrCreateService(); if (!runtimeService) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } } else { - runtimeService = workers::RuntimeService::GetService(); + runtimeService = RuntimeService::GetService(); } MOZ_ASSERT(runtimeService); @@ -3138,7 +3139,7 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindowInner* aWindow, MOZ_ASSERT_IF(NS_IsMainThread(), aCx == nsContentUtils::GetCurrentJSContext()); if (aWindow) { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); } WorkerLoadInfo loadInfo; @@ -3188,7 +3189,7 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindowInner* aWindow, aParent->ServiceWorkersTestingInWindow(); loadInfo.mParentController = aParent->GetController(); } else { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); // Make sure that the IndexedDatabaseManager is set up Unused << NS_WARN_IF(!IndexedDatabaseManager::GetOrCreate()); @@ -5535,7 +5536,7 @@ WorkerPrivate::DumpCrashInformation(nsACString& aString) PerformanceStorage* WorkerPrivate::GetPerformanceStorage() { - workers::AssertIsOnMainThread(); + AssertIsOnMainThread(); if (!mPerformanceStorage) { mPerformanceStorage = PerformanceStorageWorker::Create(this); diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index a10c79c51cf2..cf07f72c881a 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -7,7 +7,7 @@ #ifndef mozilla_dom_workers_workerprivate_h__ #define mozilla_dom_workers_workerprivate_h__ -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/CondVar.h" #include "mozilla/DOMEventTargetHelper.h" #include "nsDOMNavigationTiming.h" @@ -18,7 +18,8 @@ #include "mozilla/dom/WorkerHolder.h" #include "mozilla/dom/WorkerLoadInfo.h" -#include "mozilla/dom/workers/Queue.h" +#include "mozilla/dom/workerinternals/JSSettings.h" +#include "mozilla/dom/workerinternals/Queue.h" #ifdef XP_WIN #undef PostMessage @@ -144,7 +145,7 @@ private: nsTArray> mQueuedRunnables; // Protected by mMutex. - workers::JSSettings mJSSettings; + workerinternals::JSSettings mJSSettings; // Only touched on the parent thread (currently this is always the main // thread as SharedWorkers are always top-level). @@ -707,7 +708,7 @@ public: } void - CopyJSSettings(workers::JSSettings& aSettings) + CopyJSSettings(workerinternals::JSSettings& aSettings) { mozilla::MutexAutoLock lock(mMutex); aSettings = mJSSettings; @@ -889,8 +890,8 @@ class WorkerPrivate : public WorkerPrivateParent bool mDebuggerRegistered; WorkerDebugger* mDebugger; - workersinternals::Queue mControlQueue; - workersinternals::Queue mDebuggerQueue; + workerinternals::Queue mControlQueue; + workerinternals::Queue mDebuggerQueue; // Touched on multiple threads, protected with mMutex. JSContext* mJSContext; diff --git a/dom/workers/WorkerRunnable.h b/dom/workers/WorkerRunnable.h index f9499146ab65..bf15f6026b09 100644 --- a/dom/workers/WorkerRunnable.h +++ b/dom/workers/WorkerRunnable.h @@ -7,7 +7,7 @@ #ifndef mozilla_dom_workers_workerrunnable_h__ #define mozilla_dom_workers_workerrunnable_h__ -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/dom/WorkerHolder.h" #include "nsICancelableRunnable.h" diff --git a/dom/workers/WorkerScope.h b/dom/workers/WorkerScope.h index 7ccc3ffe0d03..fbc4aacf30ab 100644 --- a/dom/workers/WorkerScope.h +++ b/dom/workers/WorkerScope.h @@ -7,7 +7,7 @@ #ifndef mozilla_dom_workerscope_h__ #define mozilla_dom_workerscope_h__ -#include "mozilla/dom/workers/WorkerCommon.h" +#include "mozilla/dom/WorkerCommon.h" #include "mozilla/DOMEventTargetHelper.h" #include "mozilla/dom/Headers.h" #include "mozilla/dom/RequestBinding.h" diff --git a/dom/workers/WorkerThread.h b/dom/workers/WorkerThread.h index 9f11c120238c..978f6ccd7610 100644 --- a/dom/workers/WorkerThread.h +++ b/dom/workers/WorkerThread.h @@ -23,7 +23,7 @@ class WorkerRunnable; class WorkerPrivate; template class WorkerPrivateParent; -namespace workers { +namespace workerinternals { class RuntimeService; } @@ -32,7 +32,7 @@ class RuntimeService; // full access to private methods (as would happen if they were simply friends). class WorkerThreadFriendKey { - friend class workers::RuntimeService; + friend class workerinternals::RuntimeService; friend class WorkerPrivate; friend class WorkerPrivateParent; diff --git a/dom/workers/moz.build b/dom/workers/moz.build index e40df709178f..0d777ad5a7d8 100644 --- a/dom/workers/moz.build +++ b/dom/workers/moz.build @@ -10,6 +10,7 @@ with Files("**"): # Public stuff. EXPORTS.mozilla.dom += [ 'SharedWorker.h', + 'WorkerCommon.h', 'WorkerDebugger.h', 'WorkerDebuggerManager.h', 'WorkerHolder.h', @@ -22,10 +23,11 @@ EXPORTS.mozilla.dom += [ 'WorkerScope.h', ] -EXPORTS.mozilla.dom.workers += [ +# Private stuff. +EXPORTS.mozilla.dom.workerinternals += [ + 'JSSettings.h', 'Queue.h', 'RuntimeService.h', - 'WorkerCommon.h', ] XPIDL_MODULE = 'dom_workers'