Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WorkerBase_h | |
| 6 #define WorkerBase_h | |
| 7 | |
| 8 #include "core/CoreExport.h" | |
| 9 #include "core/dom/ActiveDOMObject.h" | |
| 10 #include "core/dom/MessagePort.h" | |
| 11 #include "core/events/EventListener.h" | |
| 12 #include "core/events/EventTarget.h" | |
| 13 #include "core/workers/AbstractWorker.h" | |
| 14 #include "core/workers/WorkerScriptLoaderClient.h" | |
| 15 #include "platform/heap/Handle.h" | |
| 16 #include "wtf/Forward.h" | |
| 17 #include "wtf/PassRefPtr.h" | |
| 18 #include "wtf/RefPtr.h" | |
| 19 #include "wtf/text/AtomicStringHash.h" | |
| 20 | |
| 21 namespace blink { | |
| 22 | |
| 23 class ExceptionState; | |
| 24 class ExecutionContext; | |
| 25 class WorkerGlobalScopeProxy; | |
| 26 class WorkerScriptLoader; | |
| 27 | |
| 28 class CORE_EXPORT WorkerBase : public AbstractWorker, private WorkerScriptLoader Client { | |
|
kinuko
2015/04/09 08:11:34
Could this be called InProcessWorkerBase or someth
sadrul
2015/04/09 18:53:40
Done.
| |
| 29 public: | |
| 30 virtual ~WorkerBase(); | |
| 31 | |
| 32 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag e, const MessagePortArray*, ExceptionState&); | |
| 33 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.
| |
| 34 void terminate(); | |
| 35 | |
| 36 void stop() override; | |
| 37 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.
| |
| 38 | |
| 39 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | |
| 40 | |
| 41 DECLARE_VIRTUAL_TRACE(); | |
| 42 | |
| 43 protected: | |
| 44 explicit WorkerBase(ExecutionContext*); | |
| 45 virtual WorkerGlobalScopeProxy* createWorkerGlobalScopeProxy(ExecutionContex t*) = 0; | |
|
kinuko
2015/04/09 08:11:34
Please document.
sadrul
2015/04/09 18:53:40
Done.
| |
| 46 | |
| 47 private: | |
| 48 // WorkerScriptLoaderClient callbacks | |
| 49 void didReceiveResponse(unsigned long identifier, const ResourceResponse&) o verride; | |
| 50 void notifyFinished() override; | |
| 51 | |
| 52 RefPtr<WorkerScriptLoader> m_scriptLoader; | |
| 53 WorkerGlobalScopeProxy* m_contextProxy; // The proxy outlives the worker to perform thread shutdown. | |
| 54 }; | |
| 55 | |
| 56 } // namespace blink | |
| 57 | |
| 58 #endif // WorkerBase_h | |
| OLD | NEW |