author | Ehsan Akhgari <ehsan@mozilla.com> |
Mon, 27 Oct 2014 12:03:00 +0100 | |
changeset 214053 | 736c29dc81cefb022e12325995f2f36ba18f70c0 |
parent 214052 | ed211a407dde887c2fab6788004ecc655ee635d7 |
child 214054 | 7fabdf3714a5fb2ffa9318a0e9a051d50eeb1e36 |
push id | 27771 |
push user | ryanvm@gmail.com |
push date | Wed, 05 Nov 2014 19:04:24 +0000 |
treeherder | mozilla-central@305b4fecce99 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | baku |
bugs | 982726 |
milestone | 36.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/workers/ServiceWorkerClients.h +++ b/dom/workers/ServiceWorkerClients.h @@ -4,29 +4,28 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_dom_workers_serviceworkerclients_h #define mozilla_dom_workers_serviceworkerclients_h #include "nsAutoPtr.h" #include "nsWrapperCache.h" +#include "mozilla/dom/WorkerScope.h" namespace mozilla { class ErrorResult; namespace dom { class Promise; namespace workers { -class ServiceWorkerGlobalScope; - class ServiceWorkerClients MOZ_FINAL : public nsISupports, public nsWrapperCache { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ServiceWorkerClients) ServiceWorkerClients(ServiceWorkerGlobalScope* aWorkerScope);
--- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -28,16 +28,17 @@ #include "Location.h" #include "Navigator.h" #include "Principal.h" #include "RuntimeService.h" #include "ScriptLoader.h" #include "WorkerPrivate.h" #include "WorkerRunnable.h" #include "Performance.h" +#include "ServiceWorkerClients.h" #define UNWRAP_WORKER_OBJECT(Interface, obj, value) \ UnwrapObject<prototypes::id::Interface##_workers, \ mozilla::dom::Interface##Binding_workers::NativeType>(obj, value) using namespace mozilla; using namespace mozilla::dom; USING_WORKERS_NAMESPACE @@ -369,30 +370,44 @@ NS_IMPL_RELEASE_INHERITED(ServiceWorkerG ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(WorkerPrivate* aWorkerPrivate, const nsACString& aScope) : WorkerGlobalScope(aWorkerPrivate), mScope(NS_ConvertUTF8toUTF16(aScope)) { } +ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope() +{ +} + JSObject* ServiceWorkerGlobalScope::WrapGlobalObject(JSContext* aCx) { mWorkerPrivate->AssertIsOnWorkerThread(); MOZ_ASSERT(mWorkerPrivate->IsServiceWorker()); JS::CompartmentOptions options; mWorkerPrivate->CopyJSCompartmentOptions(options); return ServiceWorkerGlobalScopeBinding_workers::Wrap(aCx, this, this, options, GetWorkerPrincipal(), true); } +ServiceWorkerClients* +ServiceWorkerGlobalScope::Clients() +{ + if (!mClients) { + mClients = new ServiceWorkerClients(this); + } + + return mClients; +} + bool GetterOnlyJSNative(JSContext* aCx, unsigned aArgc, JS::Value* aVp) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, nullptr, JSMSG_GETTER_ONLY); return false; } namespace {
--- a/dom/workers/WorkerScope.h +++ b/dom/workers/WorkerScope.h @@ -6,31 +6,30 @@ #ifndef mozilla_dom_workerscope_h__ #define mozilla_dom_workerscope_h__ #include "Workers.h" #include "mozilla/DOMEventTargetHelper.h" #include "mozilla/dom/Headers.h" #include "mozilla/dom/RequestBinding.h" -#include "ServiceWorkerClients.h" - namespace mozilla { namespace dom { class Console; class Function; class Promise; class RequestOrScalarValueString; } // namespace dom } // namespace mozilla BEGIN_WORKERS_NAMESPACE +class ServiceWorkerClients; class WorkerPrivate; class WorkerLocation; class WorkerNavigator; class Performance; class WorkerGlobalScope : public DOMEventTargetHelper, public nsIGlobalObject { @@ -169,17 +168,17 @@ public: IMPL_EVENT_HANDLER(connect) }; class ServiceWorkerGlobalScope MOZ_FINAL : public WorkerGlobalScope { const nsString mScope; nsRefPtr<ServiceWorkerClients> mClients; - ~ServiceWorkerGlobalScope() { } + ~ServiceWorkerGlobalScope(); public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServiceWorkerGlobalScope, WorkerGlobalScope) ServiceWorkerGlobalScope(WorkerPrivate* aWorkerPrivate, const nsACString& aScope); @@ -203,30 +202,30 @@ public: { // FIXME(nsm): Bug 982728 } already_AddRefed<Promise> Unregister(ErrorResult& aRv); ServiceWorkerClients* - Clients() { - if (!mClients) { - mClients = new ServiceWorkerClients(this); - } - - return mClients; - } + Clients(); IMPL_EVENT_HANDLER(activate) IMPL_EVENT_HANDLER(beforeevicted) IMPL_EVENT_HANDLER(evicted) IMPL_EVENT_HANDLER(fetch) IMPL_EVENT_HANDLER(install) IMPL_EVENT_HANDLER(message) }; JSObject* CreateGlobalScope(JSContext* aCx); END_WORKERS_NAMESPACE +inline nsISupports* +ToSupports(mozilla::dom::workers::WorkerGlobalScope* aScope) +{ + return static_cast<nsIDOMEventTarget*>(aScope); +} + #endif /* mozilla_dom_workerscope_h__ */