OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 11 matching lines...) Expand all Loading... |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 * | 24 * |
25 */ | 25 */ |
26 | 26 |
27 #ifndef InProcessWorkerMessagingProxy_h | 27 #ifndef InProcessWorkerMessagingProxy_h |
28 #define InProcessWorkerMessagingProxy_h | 28 #define InProcessWorkerMessagingProxy_h |
29 | 29 |
30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
31 #include "core/dom/ExecutionContext.h" | 31 #include "core/dom/ExecutionContext.h" |
32 #include "core/workers/InProcessWorkerGlobalScopeProxy.h" | 32 #include "core/dom/MessagePort.h" |
| 33 #include "core/inspector/ConsoleTypes.h" |
33 #include "core/workers/WorkerLoaderProxy.h" | 34 #include "core/workers/WorkerLoaderProxy.h" |
34 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
35 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
36 #include "wtf/Noncopyable.h" | 37 #include "wtf/Noncopyable.h" |
37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
38 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
39 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
40 #include <memory> | 41 #include <memory> |
41 | 42 |
42 namespace blink { | 43 namespace blink { |
43 | 44 |
44 class ExecutionContext; | 45 class ExecutionContext; |
45 class InProcessWorkerBase; | 46 class InProcessWorkerBase; |
46 class InProcessWorkerObjectProxy; | 47 class InProcessWorkerObjectProxy; |
47 class ParentFrameTaskRunners; | 48 class ParentFrameTaskRunners; |
48 class WorkerClients; | 49 class WorkerClients; |
49 class WorkerInspectorProxy; | 50 class WorkerInspectorProxy; |
50 class WorkerThread; | 51 class WorkerThread; |
51 | 52 |
52 // TODO(nhiroki): "MessagingProxy" is not well-defined term among worker | 53 // TODO(nhiroki): "MessagingProxy" is not well-defined term among worker |
53 // components. Probably we should rename this to something more suitable. | 54 // components. Probably we should rename this to something more suitable. |
54 // (http://crbug.com/603785) | 55 // (http://crbug.com/603785) |
55 class CORE_EXPORT InProcessWorkerMessagingProxy | 56 class CORE_EXPORT InProcessWorkerMessagingProxy : private WorkerLoaderProxyProvi
der { |
56 : public InProcessWorkerGlobalScopeProxy | |
57 , private WorkerLoaderProxyProvider { | |
58 WTF_MAKE_NONCOPYABLE(InProcessWorkerMessagingProxy); | 57 WTF_MAKE_NONCOPYABLE(InProcessWorkerMessagingProxy); |
59 public: | 58 public: |
60 // Implementations of InProcessWorkerGlobalScopeProxy. | 59 // These methods should only be used on the parent context thread. |
61 // (Only use these methods in the parent context thread.) | 60 void startWorkerGlobalScope(const KURL& scriptURL, const String& userAgent,
const String& sourceCode); |
62 void startWorkerGlobalScope(const KURL& scriptURL, const String& userAgent,
const String& sourceCode) override; | 61 void terminateWorkerGlobalScope(); |
63 void terminateWorkerGlobalScope() override; | 62 void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue>, std::
unique_ptr<MessagePortChannelArray>); |
64 void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue>, std::
unique_ptr<MessagePortChannelArray>) override; | 63 bool hasPendingActivity() const; |
65 bool hasPendingActivity() const final; | 64 void workerObjectDestroyed(); |
66 void workerObjectDestroyed() override; | |
67 | 65 |
68 // These methods come from worker context thread via | 66 // These methods come from worker context thread via |
69 // InProcessWorkerObjectProxy and are called on the parent context thread. | 67 // InProcessWorkerObjectProxy and are called on the parent context thread. |
70 void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, std::uniqu
e_ptr<MessagePortChannelArray>); | 68 void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, std::uniqu
e_ptr<MessagePortChannelArray>); |
71 void dispatchErrorEvent(const String& errorMessage, std::unique_ptr<SourceLo
cation>, int exceptionId); | 69 void dispatchErrorEvent(const String& errorMessage, std::unique_ptr<SourceLo
cation>, int exceptionId); |
72 void reportConsoleMessage(MessageSource, MessageLevel, const String& message
, std::unique_ptr<SourceLocation>); | 70 void reportConsoleMessage(MessageSource, MessageLevel, const String& message
, std::unique_ptr<SourceLocation>); |
73 void postMessageToPageInspector(const String&); | 71 void postMessageToPageInspector(const String&); |
74 | 72 |
75 // 'virtual' for testing. | 73 // 'virtual' for testing. |
76 virtual void confirmMessageFromWorkerObject(); | 74 virtual void confirmMessageFromWorkerObject(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 Persistent<WorkerClients> m_workerClients; | 128 Persistent<WorkerClients> m_workerClients; |
131 | 129 |
132 Persistent<ParentFrameTaskRunners> m_parentFrameTaskRunners; | 130 Persistent<ParentFrameTaskRunners> m_parentFrameTaskRunners; |
133 | 131 |
134 RefPtr<WorkerLoaderProxy> m_loaderProxy; | 132 RefPtr<WorkerLoaderProxy> m_loaderProxy; |
135 }; | 133 }; |
136 | 134 |
137 } // namespace blink | 135 } // namespace blink |
138 | 136 |
139 #endif // InProcessWorkerMessagingProxy_h | 137 #endif // InProcessWorkerMessagingProxy_h |
OLD | NEW |