зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1744025: Use CheckedUnsafePtr<WorkerPrivate> in WorkerGlobalScopeBase. r=dom-worker-reviewers,asuth
Depends on D132708 Differential Revision: https://phabricator.services.mozilla.com/D132709
This commit is contained in:
Родитель
7f3037fee8
Коммит
4de896f8ef
|
@ -42,7 +42,7 @@
|
|||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/dom/WindowBinding.h" // For IdleRequestCallback/Options
|
||||
#include "mozilla/dom/WindowGlobalParent.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
||||
#include "mozilla/net/UrlClassifierFeatureFactory.h"
|
||||
#include "IOActivityMonitor.h"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PerformanceWorker.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
|
||||
namespace mozilla::dom {
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "mozilla/dom/RemoteWorkerService.h"
|
||||
#include "mozilla/dom/TimeoutHandler.h"
|
||||
#include "mozilla/dom/WorkerBinding.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/dom/JSExecutionManager.h"
|
||||
#include "mozilla/dom/WindowContext.h"
|
||||
#include "mozilla/extensions/ExtensionBrowser.h" // extensions::Create{AndDispatchInitWorkerContext,WorkerLoaded,WorkerDestroyed}Runnable
|
||||
|
@ -5273,15 +5274,14 @@ WorkerGlobalScope* WorkerPrivate::GetOrCreateGlobalScope(JSContext* aCx) {
|
|||
}
|
||||
|
||||
if (IsSharedWorker()) {
|
||||
data->mScope = new SharedWorkerGlobalScope(
|
||||
WrapNotNull(this), CreateClientSource(), WorkerName());
|
||||
} else if (IsServiceWorker()) {
|
||||
data->mScope =
|
||||
new ServiceWorkerGlobalScope(WrapNotNull(this), CreateClientSource(),
|
||||
GetServiceWorkerRegistrationDescriptor());
|
||||
new SharedWorkerGlobalScope(this, CreateClientSource(), WorkerName());
|
||||
} else if (IsServiceWorker()) {
|
||||
data->mScope = new ServiceWorkerGlobalScope(
|
||||
this, CreateClientSource(), GetServiceWorkerRegistrationDescriptor());
|
||||
} else {
|
||||
data->mScope = new DedicatedWorkerGlobalScope(
|
||||
WrapNotNull(this), CreateClientSource(), WorkerName());
|
||||
data->mScope = new DedicatedWorkerGlobalScope(this, CreateClientSource(),
|
||||
WorkerName());
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> global(aCx);
|
||||
|
@ -5310,7 +5310,7 @@ WorkerDebuggerGlobalScope* WorkerPrivate::CreateDebuggerGlobalScope(
|
|||
GetClientType(), HybridEventTarget(), NullPrincipalInfo());
|
||||
|
||||
data->mDebuggerScope =
|
||||
new WorkerDebuggerGlobalScope(WrapNotNull(this), std::move(clientSource));
|
||||
new WorkerDebuggerGlobalScope(this, std::move(clientSource));
|
||||
|
||||
JS::Rooted<JSObject*> global(aCx);
|
||||
NS_ENSURE_TRUE(data->mDebuggerScope->WrapGlobalObject(aCx, &global), nullptr);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "mozilla/dom/Worker.h"
|
||||
#include "mozilla/dom/WorkerCommon.h"
|
||||
#include "mozilla/dom/WorkerLoadInfo.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/dom/WorkerStatus.h"
|
||||
#include "mozilla/dom/workerinternals/JSSettings.h"
|
||||
#include "mozilla/dom/workerinternals/Queue.h"
|
||||
|
|
|
@ -218,8 +218,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WorkerGlobalScopeBase)
|
|||
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
|
||||
|
||||
WorkerGlobalScopeBase::WorkerGlobalScopeBase(
|
||||
NotNull<WorkerPrivate*> aWorkerPrivate,
|
||||
UniquePtr<ClientSource> aClientSource)
|
||||
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource)
|
||||
: mWorkerPrivate(aWorkerPrivate),
|
||||
mClientSource(std::move(aClientSource)),
|
||||
mSerialEventTarget(aWorkerPrivate->HybridEventTarget()) {
|
||||
|
@ -781,9 +780,9 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(DedicatedWorkerGlobalScope,
|
|||
WorkerGlobalScope)
|
||||
|
||||
DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(
|
||||
NotNull<WorkerPrivate*> aWorkerPrivate,
|
||||
UniquePtr<ClientSource> aClientSource, const nsString& aName)
|
||||
: WorkerGlobalScope(aWorkerPrivate, std::move(aClientSource)),
|
||||
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource,
|
||||
const nsString& aName)
|
||||
: WorkerGlobalScope(std::move(aWorkerPrivate), std::move(aClientSource)),
|
||||
NamedWorkerGlobalScopeMixin(aName) {}
|
||||
|
||||
bool DedicatedWorkerGlobalScope::WrapGlobalObject(
|
||||
|
@ -955,9 +954,9 @@ void DedicatedWorkerGlobalScope::OnVsync(const VsyncEvent& aVsync) {
|
|||
}
|
||||
|
||||
SharedWorkerGlobalScope::SharedWorkerGlobalScope(
|
||||
NotNull<WorkerPrivate*> aWorkerPrivate,
|
||||
UniquePtr<ClientSource> aClientSource, const nsString& aName)
|
||||
: WorkerGlobalScope(aWorkerPrivate, std::move(aClientSource)),
|
||||
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource,
|
||||
const nsString& aName)
|
||||
: WorkerGlobalScope(std::move(aWorkerPrivate), std::move(aClientSource)),
|
||||
NamedWorkerGlobalScopeMixin(aName) {}
|
||||
|
||||
bool SharedWorkerGlobalScope::WrapGlobalObject(
|
||||
|
@ -989,10 +988,9 @@ NS_IMPL_ADDREF_INHERITED(ServiceWorkerGlobalScope, WorkerGlobalScope)
|
|||
NS_IMPL_RELEASE_INHERITED(ServiceWorkerGlobalScope, WorkerGlobalScope)
|
||||
|
||||
ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(
|
||||
NotNull<WorkerPrivate*> aWorkerPrivate,
|
||||
UniquePtr<ClientSource> aClientSource,
|
||||
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource,
|
||||
const ServiceWorkerRegistrationDescriptor& aRegistrationDescriptor)
|
||||
: WorkerGlobalScope(aWorkerPrivate, std::move(aClientSource)),
|
||||
: WorkerGlobalScope(std::move(aWorkerPrivate), std::move(aClientSource)),
|
||||
mScope(NS_ConvertUTF8toUTF16(aRegistrationDescriptor.Scope()))
|
||||
|
||||
// Eagerly create the registration because we will need to receive
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "mozilla/dom/ImageBitmapBinding.h"
|
||||
#include "mozilla/dom/ImageBitmapSource.h"
|
||||
#include "mozilla/dom/SafeRefPtr.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIGlobalObject.h"
|
||||
|
@ -93,7 +94,7 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
|
|||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(WorkerGlobalScopeBase,
|
||||
DOMEventTargetHelper)
|
||||
|
||||
WorkerGlobalScopeBase(NotNull<WorkerPrivate*> aWorkerPrivate,
|
||||
WorkerGlobalScopeBase(WorkerPrivate* aWorkerPrivate,
|
||||
UniquePtr<ClientSource> aClientSource);
|
||||
|
||||
virtual bool WrapGlobalObject(JSContext* aCx,
|
||||
|
@ -162,7 +163,7 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
|
|||
protected:
|
||||
~WorkerGlobalScopeBase();
|
||||
|
||||
const NotNull<WorkerPrivate*> mWorkerPrivate;
|
||||
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
|
||||
|
||||
private:
|
||||
RefPtr<Console> mConsole;
|
||||
|
@ -344,7 +345,7 @@ class DedicatedWorkerGlobalScope final
|
|||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
|
||||
DedicatedWorkerGlobalScope, WorkerGlobalScope)
|
||||
|
||||
DedicatedWorkerGlobalScope(NotNull<WorkerPrivate*> aWorkerPrivate,
|
||||
DedicatedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
|
||||
UniquePtr<ClientSource> aClientSource,
|
||||
const nsString& aName);
|
||||
|
||||
|
@ -388,7 +389,7 @@ class SharedWorkerGlobalScope final
|
|||
: public WorkerGlobalScope,
|
||||
public workerinternals::NamedWorkerGlobalScopeMixin {
|
||||
public:
|
||||
SharedWorkerGlobalScope(NotNull<WorkerPrivate*> aWorkerPrivate,
|
||||
SharedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
|
||||
UniquePtr<ClientSource> aClientSource,
|
||||
const nsString& aName);
|
||||
|
||||
|
@ -410,8 +411,7 @@ class ServiceWorkerGlobalScope final : public WorkerGlobalScope {
|
|||
WorkerGlobalScope)
|
||||
|
||||
ServiceWorkerGlobalScope(
|
||||
NotNull<WorkerPrivate*> aWorkerPrivate,
|
||||
UniquePtr<ClientSource> aClientSource,
|
||||
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource,
|
||||
const ServiceWorkerRegistrationDescriptor& aRegistrationDescriptor);
|
||||
|
||||
bool WrapGlobalObject(JSContext* aCx,
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "mozilla/dom/ClonedErrorHolderBinding.h"
|
||||
#include "mozilla/dom/ExtensionBrowserBinding.h"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/dom/SerializedStackHolder.h"
|
||||
#include "mozilla/dom/ServiceWorkerInfo.h"
|
||||
#include "mozilla/dom/ServiceWorkerManager.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "mozilla/dom/ExtensionBrowserBinding.h"
|
||||
#include "mozilla/dom/ExtensionPortBinding.h" // ExtensionPortDescriptor
|
||||
#include "mozilla/dom/WorkerPrivate.h" // GetWorkerPrivateFromContext
|
||||
#include "mozilla/dom/WorkerScope.h" // GetWorkerPrivateFromContext
|
||||
#include "mozilla/extensions/ExtensionAlarms.h"
|
||||
#include "mozilla/extensions/ExtensionMockAPI.h"
|
||||
#include "mozilla/extensions/ExtensionPort.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче