Index: Source/core/workers/WorkerBase.h |
diff --git a/Source/core/workers/WorkerBase.h b/Source/core/workers/WorkerBase.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..637f47f1c497786a22cf7c255e64be09c42bbbd1 |
--- /dev/null |
+++ b/Source/core/workers/WorkerBase.h |
@@ -0,0 +1,58 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef WorkerBase_h |
+#define WorkerBase_h |
+ |
+#include "core/CoreExport.h" |
+#include "core/dom/ActiveDOMObject.h" |
+#include "core/dom/MessagePort.h" |
+#include "core/events/EventListener.h" |
+#include "core/events/EventTarget.h" |
+#include "core/workers/AbstractWorker.h" |
+#include "core/workers/WorkerScriptLoaderClient.h" |
+#include "platform/heap/Handle.h" |
+#include "wtf/Forward.h" |
+#include "wtf/PassRefPtr.h" |
+#include "wtf/RefPtr.h" |
+#include "wtf/text/AtomicStringHash.h" |
+ |
+namespace blink { |
+ |
+class ExceptionState; |
+class ExecutionContext; |
+class WorkerGlobalScopeProxy; |
+class WorkerScriptLoader; |
+ |
+class CORE_EXPORT WorkerBase : public AbstractWorker, private WorkerScriptLoaderClient { |
kinuko
2015/04/09 08:11:34
Could this be called InProcessWorkerBase or someth
sadrul
2015/04/09 18:53:40
Done.
|
+public: |
+ virtual ~WorkerBase(); |
+ |
+ void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionState&); |
+ bool initialize(ExecutionContext*, const String&, ExceptionState&); |
kinuko
2015/04/09 08:11:34
Looks like this could be protected.
sadrul
2015/04/09 18:53:40
Done.
|
+ void terminate(); |
+ |
+ void stop() override; |
+ bool hasPendingActivity() const override; |
kinuko
2015/04/09 08:11:34
Please comment that they're ActiveDOMObject overri
sadrul
2015/04/09 18:53:40
Done.
|
+ |
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
+ |
+ DECLARE_VIRTUAL_TRACE(); |
+ |
+protected: |
+ explicit WorkerBase(ExecutionContext*); |
+ virtual WorkerGlobalScopeProxy* createWorkerGlobalScopeProxy(ExecutionContext*) = 0; |
kinuko
2015/04/09 08:11:34
Please document.
sadrul
2015/04/09 18:53:40
Done.
|
+ |
+private: |
+ // WorkerScriptLoaderClient callbacks |
+ void didReceiveResponse(unsigned long identifier, const ResourceResponse&) override; |
+ void notifyFinished() override; |
+ |
+ RefPtr<WorkerScriptLoader> m_scriptLoader; |
+ WorkerGlobalScopeProxy* m_contextProxy; // The proxy outlives the worker to perform thread shutdown. |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // WorkerBase_h |