зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1503236 - Move WorkletImpl reference from WorkletGlobalScope to classes inheriting WorkletGlobalScope r=karlt
Differential Revision: https://phabricator.services.mozilla.com/D10215 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f5b7112fd5
Коммит
6c33998bfb
|
@ -5,6 +5,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "AudioWorkletGlobalScope.h"
|
||||
|
||||
#include "AudioWorkletImpl.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/dom/AudioWorkletGlobalScopeBinding.h"
|
||||
#include "mozilla/dom/WorkletPrincipal.h"
|
||||
|
@ -21,8 +23,8 @@ NS_INTERFACE_MAP_END_INHERITING(WorkletGlobalScope)
|
|||
NS_IMPL_ADDREF_INHERITED(AudioWorkletGlobalScope, WorkletGlobalScope)
|
||||
NS_IMPL_RELEASE_INHERITED(AudioWorkletGlobalScope, WorkletGlobalScope)
|
||||
|
||||
AudioWorkletGlobalScope::AudioWorkletGlobalScope(WorkletImpl* aImpl)
|
||||
: WorkletGlobalScope(aImpl)
|
||||
AudioWorkletGlobalScope::AudioWorkletGlobalScope(AudioWorkletImpl* aImpl)
|
||||
: mImpl(aImpl)
|
||||
, mCurrentFrame(0)
|
||||
, mCurrentTime(0)
|
||||
, mSampleRate(0.0)
|
||||
|
@ -189,6 +191,11 @@ AudioWorkletGlobalScope::RegisterProcessor(JSContext* aCx,
|
|||
// and https://bugzilla.mozilla.org/show_bug.cgi?id=1492014
|
||||
}
|
||||
|
||||
WorkletImpl* AudioWorkletGlobalScope::Impl() const
|
||||
{
|
||||
return mImpl;
|
||||
}
|
||||
|
||||
uint64_t AudioWorkletGlobalScope::CurrentFrame() const
|
||||
{
|
||||
return mCurrentFrame;
|
||||
|
|
|
@ -13,18 +13,17 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class WorkletImpl;
|
||||
class AudioWorkletImpl;
|
||||
|
||||
namespace dom {
|
||||
|
||||
|
||||
class AudioWorkletGlobalScope final : public WorkletGlobalScope
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioWorkletGlobalScope, WorkletGlobalScope);
|
||||
|
||||
explicit AudioWorkletGlobalScope(WorkletImpl* aImpl);
|
||||
explicit AudioWorkletGlobalScope(AudioWorkletImpl* aImpl);
|
||||
|
||||
bool
|
||||
WrapGlobalObject(JSContext* aCx,
|
||||
|
@ -35,6 +34,8 @@ public:
|
|||
VoidFunction& aProcessorCtor,
|
||||
ErrorResult& aRv);
|
||||
|
||||
WorkletImpl* Impl() const override;
|
||||
|
||||
uint64_t CurrentFrame() const;
|
||||
|
||||
double CurrentTime() const;
|
||||
|
@ -44,6 +45,8 @@ public:
|
|||
private:
|
||||
~AudioWorkletGlobalScope() = default;
|
||||
|
||||
const RefPtr<AudioWorkletImpl> mImpl;
|
||||
|
||||
uint64_t mCurrentFrame;
|
||||
double mCurrentTime;
|
||||
float mSampleRate;
|
||||
|
|
|
@ -36,8 +36,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WorkletGlobalScope)
|
|||
NS_INTERFACE_MAP_ENTRY(WorkletGlobalScope)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
WorkletGlobalScope::WorkletGlobalScope(WorkletImpl* aImpl)
|
||||
: mImpl(aImpl)
|
||||
WorkletGlobalScope::WorkletGlobalScope()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -55,7 +54,8 @@ already_AddRefed<Console>
|
|||
WorkletGlobalScope::GetConsole(JSContext* aCx, ErrorResult& aRv)
|
||||
{
|
||||
if (!mConsole) {
|
||||
const WorkletLoadInfo& loadInfo = mImpl->LoadInfo();
|
||||
MOZ_ASSERT(Impl());
|
||||
const WorkletLoadInfo& loadInfo = Impl()->LoadInfo();
|
||||
mConsole = Console::CreateForWorklet(aCx, this,
|
||||
loadInfo.OuterWindowID(),
|
||||
loadInfo.InnerWindowID(), aRv);
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WorkletGlobalScope)
|
||||
|
||||
explicit WorkletGlobalScope(WorkletImpl* aImpl);
|
||||
WorkletGlobalScope();
|
||||
|
||||
nsIGlobalObject* GetParentObject() const
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
already_AddRefed<Console>
|
||||
GetConsole(JSContext* aCx, ErrorResult& aRv);
|
||||
|
||||
WorkletImpl* Impl() const { return mImpl; }
|
||||
virtual WorkletImpl* Impl() const = 0;
|
||||
|
||||
void
|
||||
Dump(const Optional<nsAString>& aString) const;
|
||||
|
@ -65,7 +65,6 @@ protected:
|
|||
~WorkletGlobalScope();;
|
||||
|
||||
private:
|
||||
const RefPtr<WorkletImpl> mImpl;
|
||||
RefPtr<Console> mConsole;
|
||||
};
|
||||
|
||||
|
|
|
@ -5,15 +5,17 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PaintWorkletGlobalScope.h"
|
||||
|
||||
#include "mozilla/dom/WorkletPrincipal.h"
|
||||
#include "mozilla/dom/PaintWorkletGlobalScopeBinding.h"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
#include "PaintWorkletImpl.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
PaintWorkletGlobalScope::PaintWorkletGlobalScope(WorkletImpl* aImpl)
|
||||
: WorkletGlobalScope(aImpl)
|
||||
PaintWorkletGlobalScope::PaintWorkletGlobalScope(PaintWorkletImpl* aImpl)
|
||||
: mImpl(aImpl)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -35,5 +37,10 @@ PaintWorkletGlobalScope::RegisterPaint(const nsAString& aType,
|
|||
// Nothing to do here, yet.
|
||||
}
|
||||
|
||||
WorkletImpl* PaintWorkletGlobalScope::Impl() const
|
||||
{
|
||||
return mImpl;
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class WorkletImpl;
|
||||
class PaintWorkletImpl;
|
||||
|
||||
namespace dom {
|
||||
|
||||
|
@ -20,7 +20,7 @@ class VoidFunction;
|
|||
class PaintWorkletGlobalScope final : public WorkletGlobalScope
|
||||
{
|
||||
public:
|
||||
explicit PaintWorkletGlobalScope(WorkletImpl* aImpl);
|
||||
explicit PaintWorkletGlobalScope(PaintWorkletImpl* aImpl);
|
||||
|
||||
bool
|
||||
WrapGlobalObject(JSContext* aCx,
|
||||
|
@ -29,8 +29,12 @@ public:
|
|||
void
|
||||
RegisterPaint(const nsAString& aType, VoidFunction& aProcessorCtor);
|
||||
|
||||
WorkletImpl* Impl() const override;
|
||||
|
||||
private:
|
||||
~PaintWorkletGlobalScope() = default;
|
||||
|
||||
const RefPtr<PaintWorkletImpl> mImpl;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
Загрузка…
Ссылка в новой задаче