| Index: Source/core/workers/WorkerThread.h
|
| diff --git a/Source/core/workers/WorkerThread.h b/Source/core/workers/WorkerThread.h
|
| index 57b8ff8a4c97ff0867c135f8cebbc8e99d773d62..f1d083b1e768abdcbf4f0daa9be2c5610adc4de9 100644
|
| --- a/Source/core/workers/WorkerThread.h
|
| +++ b/Source/core/workers/WorkerThread.h
|
| @@ -40,112 +40,111 @@
|
| #include "wtf/RefCounted.h"
|
|
|
| namespace blink {
|
| -class WebWaitableEvent;
|
| -}
|
| -
|
| -namespace blink {
|
|
|
| - class KURL;
|
| - class WorkerGlobalScope;
|
| - class WorkerInspectorController;
|
| - class WorkerLoaderProxy;
|
| - class WorkerReportingProxy;
|
| - class WorkerSharedTimer;
|
| - class WorkerThreadShutdownFinishTask;
|
| - class WorkerThreadStartupData;
|
| - class WorkerThreadTask;
|
| -
|
| - enum WorkerThreadStartMode { DontPauseWorkerGlobalScopeOnStart, PauseWorkerGlobalScopeOnStart };
|
| +class KURL;
|
| +class WebWaitableEvent;
|
| +class WorkerGlobalScope;
|
| +class WorkerInspectorController;
|
| +class WorkerLoaderProxy;
|
| +class WorkerReportingProxy;
|
| +class WorkerSharedTimer;
|
| +class WorkerThreadShutdownFinishTask;
|
| +class WorkerThreadStartupData;
|
| +class WorkerThreadTask;
|
|
|
| +enum WorkerThreadStartMode {
|
| + DontPauseWorkerGlobalScopeOnStart,
|
| + PauseWorkerGlobalScopeOnStart
|
| +};
|
|
|
| - class WorkerThread : public RefCounted<WorkerThread> {
|
| - public:
|
| - virtual ~WorkerThread();
|
| +class WorkerThread : public RefCounted<WorkerThread> {
|
| +public:
|
| + virtual ~WorkerThread();
|
|
|
| - virtual void start();
|
| - virtual void stop();
|
| + virtual void start();
|
| + virtual void stop();
|
|
|
| - // Can be used to wait for this worker thread to shut down.
|
| - // (This is signalled on the main thread, so it's assumed to be waited on the worker context thread)
|
| - blink::WebWaitableEvent* shutdownEvent() { return m_shutdownEvent.get(); }
|
| + // Can be used to wait for this worker thread to shut down.
|
| + // (This is signalled on the main thread, so it's assumed to be waited on the worker context thread)
|
| + WebWaitableEvent* shutdownEvent() { return m_shutdownEvent.get(); }
|
|
|
| - blink::WebWaitableEvent* terminationEvent() { return m_terminationEvent.get(); }
|
| - static void terminateAndWaitForAllWorkers();
|
| + WebWaitableEvent* terminationEvent() { return m_terminationEvent.get(); }
|
| + static void terminateAndWaitForAllWorkers();
|
|
|
| - bool isCurrentThread() const;
|
| - WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProxy; }
|
| - WorkerReportingProxy& workerReportingProxy() const { return m_workerReportingProxy; }
|
| + bool isCurrentThread() const;
|
| + WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProxy; }
|
| + WorkerReportingProxy& workerReportingProxy() const { return m_workerReportingProxy; }
|
|
|
| - void postTask(PassOwnPtr<ExecutionContextTask>);
|
| - void postDebuggerTask(PassOwnPtr<ExecutionContextTask>);
|
| + void postTask(PassOwnPtr<ExecutionContextTask>);
|
| + void postDebuggerTask(PassOwnPtr<ExecutionContextTask>);
|
|
|
| - enum WaitMode { WaitForMessage, DontWaitForMessage };
|
| - MessageQueueWaitResult runDebuggerTask(WaitMode = WaitForMessage);
|
| + enum WaitMode { WaitForMessage, DontWaitForMessage };
|
| + MessageQueueWaitResult runDebuggerTask(WaitMode = WaitForMessage);
|
|
|
| - // These methods should be called if the holder of the thread is
|
| - // going to call runDebuggerTask in a loop.
|
| - void willEnterNestedLoop();
|
| - void didLeaveNestedLoop();
|
| + // These methods should be called if the holder of the thread is
|
| + // going to call runDebuggerTask in a loop.
|
| + void willEnterNestedLoop();
|
| + void didLeaveNestedLoop();
|
|
|
| - WorkerGlobalScope* workerGlobalScope() const { return m_workerGlobalScope.get(); }
|
| - bool terminated();
|
| + WorkerGlobalScope* workerGlobalScope() const { return m_workerGlobalScope.get(); }
|
| + bool terminated();
|
|
|
| - // Number of active worker threads.
|
| - static unsigned workerThreadCount();
|
| + // Number of active worker threads.
|
| + static unsigned workerThreadCount();
|
|
|
| - PlatformThreadId platformThreadId() const;
|
| + PlatformThreadId platformThreadId() const;
|
|
|
| - void interruptAndDispatchInspectorCommands();
|
| - void setWorkerInspectorController(WorkerInspectorController*);
|
| + void interruptAndDispatchInspectorCommands();
|
| + void setWorkerInspectorController(WorkerInspectorController*);
|
|
|
| - protected:
|
| - WorkerThread(WorkerLoaderProxy&, WorkerReportingProxy&, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData>);
|
| +protected:
|
| + WorkerThread(WorkerLoaderProxy&, WorkerReportingProxy&, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData>);
|
|
|
| - // Factory method for creating a new worker context for the thread.
|
| - virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0;
|
| + // Factory method for creating a new worker context for the thread.
|
| + virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0;
|
|
|
| - virtual void postInitialize() { }
|
| + virtual void postInitialize() { }
|
|
|
| - private:
|
| - friend class WorkerSharedTimer;
|
| - friend class WorkerThreadShutdownFinishTask;
|
| +private:
|
| + friend class WorkerSharedTimer;
|
| + friend class WorkerThreadShutdownFinishTask;
|
|
|
| - void stopInShutdownSequence();
|
| - void stopInternal();
|
| + void stopInShutdownSequence();
|
| + void stopInternal();
|
|
|
| - void initialize();
|
| - void cleanup();
|
| - void idleHandler();
|
| - void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs);
|
| + void initialize();
|
| + void cleanup();
|
| + void idleHandler();
|
| + void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs);
|
|
|
| - bool m_terminated;
|
| - OwnPtr<WorkerSharedTimer> m_sharedTimer;
|
| - MessageQueue<WorkerThreadTask> m_debuggerMessageQueue;
|
| - OwnPtr<WebThread::TaskObserver> m_microtaskRunner;
|
| + bool m_terminated;
|
| + OwnPtr<WorkerSharedTimer> m_sharedTimer;
|
| + MessageQueue<WorkerThreadTask> m_debuggerMessageQueue;
|
| + OwnPtr<WebThread::TaskObserver> m_microtaskRunner;
|
|
|
| - WorkerLoaderProxy& m_workerLoaderProxy;
|
| - WorkerReportingProxy& m_workerReportingProxy;
|
| + WorkerLoaderProxy& m_workerLoaderProxy;
|
| + WorkerReportingProxy& m_workerReportingProxy;
|
|
|
| - RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorController;
|
| - Mutex m_workerInspectorControllerMutex;
|
| + RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorController;
|
| + Mutex m_workerInspectorControllerMutex;
|
|
|
| - Mutex m_threadCreationMutex;
|
| - RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope;
|
| - OwnPtrWillBePersistent<WorkerThreadStartupData> m_startupData;
|
| + Mutex m_threadCreationMutex;
|
| + RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope;
|
| + OwnPtrWillBePersistent<WorkerThreadStartupData> m_startupData;
|
|
|
| - // Used to signal thread shutdown.
|
| - OwnPtr<blink::WebWaitableEvent> m_shutdownEvent;
|
| + // Used to signal thread shutdown.
|
| + OwnPtr<WebWaitableEvent> m_shutdownEvent;
|
|
|
| - // Used to signal thread termination.
|
| - OwnPtr<blink::WebWaitableEvent> m_terminationEvent;
|
| + // Used to signal thread termination.
|
| + OwnPtr<WebWaitableEvent> m_terminationEvent;
|
|
|
| - // FIXME: This has to be last because of crbug.com/401397 - the
|
| - // WorkerThread might get deleted before it had a chance to properly
|
| - // shut down. By deleting the WebThread first, we can guarantee that
|
| - // no pending tasks on the thread might want to access any of the other
|
| - // members during the WorkerThread's destruction.
|
| - OwnPtr<WebThreadSupportingGC> m_thread;
|
| - };
|
| + // FIXME: This has to be last because of crbug.com/401397 - the
|
| + // WorkerThread might get deleted before it had a chance to properly
|
| + // shut down. By deleting the WebThread first, we can guarantee that
|
| + // no pending tasks on the thread might want to access any of the other
|
| + // members during the WorkerThread's destruction.
|
| + OwnPtr<WebThreadSupportingGC> m_thread;
|
| +};
|
|
|
| } // namespace blink
|
|
|
|
|