Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1432963 - Fixing workers headers - part 13 - WorkerHolder without…
Browse files Browse the repository at this point in the history
… workers namespace, r=smaug
  • Loading branch information
bakulf committed Jan 31, 2018
1 parent d5b4692 commit deee1a5
Show file tree
Hide file tree
Showing 55 changed files with 146 additions and 165 deletions.
4 changes: 2 additions & 2 deletions dom/base/EventSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1791,9 +1791,9 @@ class EventSourceWorkerHolder final : public WorkerHolder
{
}

bool Notify(Status aStatus) override
bool Notify(WorkerStatus aStatus) override
{
MOZ_ASSERT(aStatus > workers::Running);
MOZ_ASSERT(aStatus > Running);
if (aStatus >= Canceling) {
mEventSourceImpl->Close();
}
Expand Down
2 changes: 0 additions & 2 deletions dom/bindings/Bindings.conf
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,6 @@ DOMInterfaces = {
},

'NotificationEvent': {
'headerFile': 'mozilla/dom/NotificationEvent.h',
'nativeType': 'mozilla::dom::workers::NotificationEvent',
'binaryNames': {
'notification': 'notification_'
}
Expand Down
6 changes: 3 additions & 3 deletions dom/broadcastchannel/BroadcastChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,19 +234,19 @@ class TeardownRunnable final : public nsIRunnable,

NS_IMPL_ISUPPORTS(TeardownRunnable, nsICancelableRunnable, nsIRunnable)

class BroadcastChannelWorkerHolder final : public workers::WorkerHolder
class BroadcastChannelWorkerHolder final : public WorkerHolder
{
BroadcastChannel* mChannel;

public:
explicit BroadcastChannelWorkerHolder(BroadcastChannel* aChannel)
: workers::WorkerHolder("BroadcastChannelWorkerHolder")
: WorkerHolder("BroadcastChannelWorkerHolder")
, mChannel(aChannel)
{
MOZ_COUNT_CTOR(BroadcastChannelWorkerHolder);
}

virtual bool Notify(workers::Status aStatus) override
virtual bool Notify(WorkerStatus aStatus) override
{
if (aStatus >= Closing) {
mChannel->Shutdown();
Expand Down
7 changes: 2 additions & 5 deletions dom/broadcastchannel/BroadcastChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ class PrincipalInfo;

namespace dom {

namespace workers {
class WorkerHolder;
} // namespace workers

class BroadcastChannelChild;
class BroadcastChannelMessage;
class WorkerHolder;

class BroadcastChannel final
: public DOMEventTargetHelper
Expand Down Expand Up @@ -86,7 +83,7 @@ class BroadcastChannel final

RefPtr<BroadcastChannelChild> mActor;

nsAutoPtr<workers::WorkerHolder> mWorkerHolder;
nsAutoPtr<WorkerHolder> mWorkerHolder;

nsString mChannel;

Expand Down
4 changes: 1 addition & 3 deletions dom/cache/CacheWorkerHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace mozilla {
namespace dom {
namespace cache {

using mozilla::dom::workers::Terminating;
using mozilla::dom::workers::Status;
using mozilla::dom::workers::WorkerPrivate;

// static
Expand Down Expand Up @@ -93,7 +91,7 @@ CacheWorkerHolder::Notified() const
}

bool
CacheWorkerHolder::Notify(Status aStatus)
CacheWorkerHolder::Notify(WorkerStatus aStatus)
{
NS_ASSERT_OWNINGTHREAD(CacheWorkerHolder);

Expand Down
4 changes: 2 additions & 2 deletions dom/cache/CacheWorkerHolder.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace cache {

class ActorChild;

class CacheWorkerHolder final : public workers::WorkerHolder
class CacheWorkerHolder final : public WorkerHolder
{
public:
static already_AddRefed<CacheWorkerHolder>
Expand All @@ -38,7 +38,7 @@ class CacheWorkerHolder final : public workers::WorkerHolder
bool Notified() const;

// WorkerHolder methods
virtual bool Notify(workers::Status aStatus) override;
virtual bool Notify(WorkerStatus aStatus) override;

private:
explicit CacheWorkerHolder(Behavior aBehavior);
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/ImageBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ class CreateImageBitmapFromBlobHolder final : public WorkerHolder
, mNotified(false)
{}

bool Notify(Status aStatus) override
bool Notify(WorkerStatus aStatus) override
{
if (!mNotified) {
mNotified = true;
Expand Down
1 change: 0 additions & 1 deletion dom/clients/api/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
namespace mozilla {
namespace dom {

using mozilla::dom::workers::Closing;
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
using mozilla::dom::workers::WorkerPrivate;
using mozilla::dom::ipc::StructuredCloneData;
Expand Down
2 changes: 1 addition & 1 deletion dom/clients/api/ClientDOMUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void
StartClientManagerOp(Func aFunc, const Arg& aArg, nsISerialEventTarget* aTarget,
Resolve aResolve, Reject aReject)
{
using mozilla::dom::workers::Closing;
using mozilla::dom::WorkerStatus::Closing;
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;

RefPtr<WorkerHolderToken> token;
Expand Down
1 change: 0 additions & 1 deletion dom/clients/manager/ClientManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ namespace dom {
using mozilla::ipc::BackgroundChild;
using mozilla::ipc::PBackgroundChild;
using mozilla::ipc::PrincipalInfo;
using mozilla::dom::workers::Closing;
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
using mozilla::dom::workers::WorkerPrivate;

Expand Down
7 changes: 2 additions & 5 deletions dom/crypto/WebCryptoTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include "mozilla/dom/WebCryptoCommon.h"
#include "mozilla/dom/WebCryptoTask.h"
#include "mozilla/dom/WebCryptoThreadPool.h"
#include "mozilla/dom/WorkerHolder.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/workers/bindings/WorkerHolder.h"

// Template taken from security/nss/lib/util/templates.c
// This (or SGN_EncodeDigestInfo) would ideally be exported
Expand All @@ -39,10 +39,7 @@ const SEC_ASN1Template SGN_DigestInfoTemplate[] = {
namespace mozilla {
namespace dom {

using mozilla::dom::workers::Canceling;
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
using mozilla::dom::workers::Status;
using mozilla::dom::workers::WorkerHolder;
using mozilla::dom::workers::WorkerPrivate;

// Pre-defined identifiers for telemetry histograms
Expand Down Expand Up @@ -169,7 +166,7 @@ class WebCryptoTask::InternalWorkerHolder final : public WorkerHolder
}

virtual bool
Notify(Status aStatus) override
Notify(WorkerStatus aStatus) override
{
NS_ASSERT_OWNINGTHREAD(InternalWorkerHolder);
// Do nothing here. Since WebCryptoTask dispatches back to
Expand Down
4 changes: 2 additions & 2 deletions dom/fetch/Fetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class WorkerNotifier final : public WorkerHolder
{}

bool
Notify(Status aStatus) override;
Notify(WorkerStatus aStatus) override;
};

class WorkerFetchResolver final : public FetchDriverObserver
Expand Down Expand Up @@ -780,7 +780,7 @@ class WorkerFetchResponseEndControlRunnable final : public MainThreadWorkerContr
};

bool
WorkerNotifier::Notify(Status aStatus)
WorkerNotifier::Notify(WorkerStatus aStatus)
{
if (mResolver) {
// This will nullify this object.
Expand Down
8 changes: 4 additions & 4 deletions dom/fetch/FetchConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ using namespace workers;
namespace {

template <class Derived>
class FetchBodyWorkerHolder final : public workers::WorkerHolder
class FetchBodyWorkerHolder final : public WorkerHolder
{
RefPtr<FetchBodyConsumer<Derived>> mConsumer;
bool mWasNotified;

public:
explicit FetchBodyWorkerHolder(FetchBodyConsumer<Derived>* aConsumer)
: workers::WorkerHolder("FetchBodyWorkerHolder")
: WorkerHolder("FetchBodyWorkerHolder")
, mConsumer(aConsumer)
, mWasNotified(false)
{
Expand All @@ -39,9 +39,9 @@ class FetchBodyWorkerHolder final : public workers::WorkerHolder

~FetchBodyWorkerHolder() = default;

bool Notify(workers::Status aStatus) override
bool Notify(WorkerStatus aStatus) override
{
MOZ_ASSERT(aStatus > workers::Running);
MOZ_ASSERT(aStatus > Running);
if (!mWasNotified) {
mWasNotified = true;
mConsumer->ShutDownMainThreadConsuming();
Expand Down
4 changes: 2 additions & 2 deletions dom/fetch/FetchConsumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ namespace mozilla {
namespace dom {

class Promise;
class WorkerHolder;

namespace workers {
class WorkerPrivate;
class WorkerHolder;
}

template <class Derived> class FetchBody;
Expand Down Expand Up @@ -112,7 +112,7 @@ class FetchBodyConsumer final : public nsIObserver
// Set when consuming the body is attempted on a worker.
// Unset when consumption is done/aborted.
// This WorkerHolder keeps alive the consumer via a cycle.
UniquePtr<workers::WorkerHolder> mWorkerHolder;
UniquePtr<WorkerHolder> mWorkerHolder;

nsCOMPtr<nsIGlobalObject> mGlobal;

Expand Down
2 changes: 1 addition & 1 deletion dom/fetch/FetchStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class FetchStreamWorkerHolder final : public WorkerHolder
, mWasNotified(false)
{}

bool Notify(Status aStatus) override
bool Notify(WorkerStatus aStatus) override
{
if (!mWasNotified) {
mWasNotified = true;
Expand Down
7 changes: 2 additions & 5 deletions dom/fetch/FetchStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ class nsIInputStream;
namespace mozilla {
namespace dom {

namespace workers {
class WorkerHolder;
}

class FetchStreamHolder;
class WorkerHolder;

class FetchStream final : public nsIInputStreamCallback
, public nsIObserver
Expand Down Expand Up @@ -125,7 +122,7 @@ class FetchStream final : public nsIInputStreamCallback
nsCOMPtr<nsIInputStream> mOriginalInputStream;
nsCOMPtr<nsIAsyncInputStream> mInputStream;

UniquePtr<workers::WorkerHolder> mWorkerHolder;
UniquePtr<WorkerHolder> mWorkerHolder;
};

} // dom namespace
Expand Down
2 changes: 1 addition & 1 deletion dom/fetch/FetchStreamReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FetchStreamReaderWorkerHolder final : public WorkerHolder
, mWasNotified(false)
{}

bool Notify(Status aStatus) override
bool Notify(WorkerStatus aStatus) override
{
if (!mWasNotified) {
mWasNotified = true;
Expand Down
4 changes: 1 addition & 3 deletions dom/fetch/FetchStreamReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
namespace mozilla {
namespace dom {

namespace workers {
class WorkerHolder;
}

class FetchStreamReader final : public nsIOutputStreamCallback
, public PromiseNativeHandler
Expand Down Expand Up @@ -68,7 +66,7 @@ class FetchStreamReader final : public nsIOutputStreamCallback

nsCOMPtr<nsIAsyncOutputStream> mPipeOut;

UniquePtr<workers::WorkerHolder> mWorkerHolder;
UniquePtr<WorkerHolder> mWorkerHolder;

JS::Heap<JSObject*> mReader;

Expand Down
4 changes: 2 additions & 2 deletions dom/fetch/FetchUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class WorkerStreamOwner final : public WorkerHolder
{
auto self = MakeUnique<WorkerStreamOwner>(aStream);

if (!self->HoldWorker(aWorker, workers::Closing)) {
if (!self->HoldWorker(aWorker, Closing)) {
return nullptr;
}

Expand Down Expand Up @@ -316,7 +316,7 @@ class WorkerStreamOwner final : public WorkerHolder

// WorkerHolder:

bool Notify(workers::Status aStatus) override
bool Notify(WorkerStatus aStatus) override
{
if (!mStream) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion dom/file/FileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ FileReader::DecreaseBusyCounter()
}

bool
FileReader::Notify(Status aStatus)
FileReader::Notify(WorkerStatus aStatus)
{
MOZ_ASSERT(mWorkerPrivate);
mWorkerPrivate->AssertIsOnWorkerThread();
Expand Down
4 changes: 2 additions & 2 deletions dom/file/FileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class FileReader final : public DOMEventTargetHelper,
public nsIInputStreamCallback,
public nsITimerCallback,
public nsINamed,
public workers::WorkerHolder
public WorkerHolder
{
friend class FileReaderDecreaseBusyCounter;

Expand Down Expand Up @@ -115,7 +115,7 @@ class FileReader final : public DOMEventTargetHelper,
}

// WorkerHolder
bool Notify(workers::Status) override;
bool Notify(WorkerStatus) override;

private:
virtual ~FileReader();
Expand Down
7 changes: 3 additions & 4 deletions dom/file/ipc/IPCBlobInputStreamChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class IPCBlobInputStreamWorkerHolder final : public WorkerHolder
: WorkerHolder("IPCBlobInputStreamWorkerHolder")
{}

bool Notify(Status aStatus) override
bool Notify(WorkerStatus aStatus) override
{
// We must keep the worker alive until the migration is completed.
return true;
Expand All @@ -109,8 +109,7 @@ class IPCBlobInputStreamWorkerHolder final : public WorkerHolder
class ReleaseWorkerHolderRunnable final : public CancelableRunnable
{
public:
explicit ReleaseWorkerHolderRunnable(
UniquePtr<workers::WorkerHolder>&& aWorkerHolder)
explicit ReleaseWorkerHolderRunnable(UniquePtr<WorkerHolder>&& aWorkerHolder)
: CancelableRunnable("dom::ReleaseWorkerHolderRunnable")
, mWorkerHolder(Move(aWorkerHolder))
{}
Expand All @@ -129,7 +128,7 @@ class ReleaseWorkerHolderRunnable final : public CancelableRunnable
}

private:
UniquePtr<workers::WorkerHolder> mWorkerHolder;
UniquePtr<WorkerHolder> mWorkerHolder;
};

} // anonymous
Expand Down
7 changes: 2 additions & 5 deletions dom/file/ipc/IPCBlobInputStreamChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
namespace mozilla {
namespace dom {

namespace workers {
class WorkerHolder;
}

class IPCBlobInputStream;
class WorkerHolder;

class IPCBlobInputStreamChild final
: public mozilla::ipc::PIPCBlobInputStreamChild
Expand Down Expand Up @@ -110,7 +107,7 @@ class IPCBlobInputStreamChild final

nsCOMPtr<nsISerialEventTarget> mOwningEventTarget;

UniquePtr<workers::WorkerHolder> mWorkerHolder;
UniquePtr<WorkerHolder> mWorkerHolder;
};

} // namespace dom
Expand Down
Loading

0 comments on commit deee1a5

Please sign in to comment.