Bug 982726 - Part 1.2: Break the cyclic dependency between WorkerScope.h and ServiceWorkerClients.h, and introduce a ToSupports overload for WorkerGlobalScope in order to fix the b2g builds. r=baku

This commit is contained in:
Ehsan Akhgari 2014-10-27 12:03:00 +01:00
Родитель 52441a13e4
Коммит c1a150b67c
3 изменённых файлов: 25 добавлений и 12 удалений

Просмотреть файл

@ -9,6 +9,7 @@
#include "nsAutoPtr.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/WorkerScope.h"
namespace mozilla {
@ -20,8 +21,6 @@ class Promise;
namespace workers {
class ServiceWorkerGlobalScope;
class ServiceWorkerClients MOZ_FINAL : public nsISupports,
public nsWrapperCache
{

Просмотреть файл

@ -33,6 +33,7 @@
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "Performance.h"
#include "ServiceWorkerClients.h"
#define UNWRAP_WORKER_OBJECT(Interface, obj, value) \
UnwrapObject<prototypes::id::Interface##_workers, \
@ -374,6 +375,10 @@ ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(WorkerPrivate* aWorkerPrivate
{
}
ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope()
{
}
JSObject*
ServiceWorkerGlobalScope::WrapGlobalObject(JSContext* aCx)
{
@ -388,6 +393,16 @@ ServiceWorkerGlobalScope::WrapGlobalObject(JSContext* aCx)
true);
}
ServiceWorkerClients*
ServiceWorkerGlobalScope::Clients()
{
if (!mClients) {
mClients = new ServiceWorkerClients(this);
}
return mClients;
}
bool
GetterOnlyJSNative(JSContext* aCx, unsigned aArgc, JS::Value* aVp)
{

Просмотреть файл

@ -11,8 +11,6 @@
#include "mozilla/dom/Headers.h"
#include "mozilla/dom/RequestBinding.h"
#include "ServiceWorkerClients.h"
namespace mozilla {
namespace dom {
@ -26,6 +24,7 @@ class RequestOrScalarValueString;
BEGIN_WORKERS_NAMESPACE
class ServiceWorkerClients;
class WorkerPrivate;
class WorkerLocation;
class WorkerNavigator;
@ -174,7 +173,7 @@ class ServiceWorkerGlobalScope MOZ_FINAL : public WorkerGlobalScope
const nsString mScope;
nsRefPtr<ServiceWorkerClients> mClients;
~ServiceWorkerGlobalScope() { }
~ServiceWorkerGlobalScope();
public:
NS_DECL_ISUPPORTS_INHERITED
@ -208,13 +207,7 @@ public:
Unregister(ErrorResult& aRv);
ServiceWorkerClients*
Clients() {
if (!mClients) {
mClients = new ServiceWorkerClients(this);
}
return mClients;
}
Clients();
IMPL_EVENT_HANDLER(activate)
IMPL_EVENT_HANDLER(beforeevicted)
@ -229,4 +222,10 @@ CreateGlobalScope(JSContext* aCx);
END_WORKERS_NAMESPACE
inline nsISupports*
ToSupports(mozilla::dom::workers::WorkerGlobalScope* aScope)
{
return static_cast<nsIDOMEventTarget*>(aScope);
}
#endif /* mozilla_dom_workerscope_h__ */