| 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 WorkerMessagingProxy_h | 27 #ifndef WorkerMessagingProxy_h |
| 28 #define WorkerMessagingProxy_h | 28 #define WorkerMessagingProxy_h |
| 29 | 29 |
| 30 #include "core/dom/ExecutionContext.h" | 30 #include "core/dom/ExecutionContext.h" |
| 31 #include "core/workers/WorkerGlobalScopeProxy.h" | 31 #include "core/workers/WorkerGlobalScopeProxy.h" |
| 32 #include "core/workers/WorkerInspectorProxy.h" |
| 32 #include "core/workers/WorkerLoaderProxy.h" | 33 #include "core/workers/WorkerLoaderProxy.h" |
| 33 #include "wtf/Forward.h" | 34 #include "wtf/Forward.h" |
| 34 #include "wtf/Noncopyable.h" | 35 #include "wtf/Noncopyable.h" |
| 35 #include "wtf/PassOwnPtr.h" | 36 #include "wtf/PassOwnPtr.h" |
| 36 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
| 37 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
| 38 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 class WorkerObjectProxy; | 43 class WorkerObjectProxy; |
| 43 class DedicatedWorkerThread; | 44 class DedicatedWorkerThread; |
| 44 class ExecutionContext; | 45 class ExecutionContext; |
| 45 class Worker; | 46 class Worker; |
| 46 class WorkerClients; | 47 class WorkerClients; |
| 47 | 48 |
| 48 class WorkerMessagingProxy FINAL : public WorkerGlobalScopeProxy, public WorkerL
oaderProxy { | 49 class WorkerMessagingProxy FINAL : public WorkerGlobalScopeProxy, public WorkerL
oaderProxy, public WorkerInspectorProxy { |
| 49 WTF_MAKE_NONCOPYABLE(WorkerMessagingProxy); WTF_MAKE_FAST_ALLOCATED; | 50 WTF_MAKE_NONCOPYABLE(WorkerMessagingProxy); WTF_MAKE_FAST_ALLOCATED; |
| 50 public: | 51 public: |
| 51 WorkerMessagingProxy(Worker*, PassOwnPtrWillBeRawPtr<WorkerClients>); | 52 WorkerMessagingProxy(Worker*, PassOwnPtrWillBeRawPtr<WorkerClients>); |
| 52 | 53 |
| 53 // Implementations of WorkerGlobalScopeProxy. | 54 // Implementations of WorkerGlobalScopeProxy. |
| 54 // (Only use these methods in the worker object thread.) | 55 // (Only use these methods in the worker object thread.) |
| 55 virtual void startWorkerGlobalScope(const KURL& scriptURL, const String& use
rAgent, const String& sourceCode, WorkerThreadStartMode) OVERRIDE; | 56 virtual void startWorkerGlobalScope(const KURL& scriptURL, const String& use
rAgent, const String& sourceCode, WorkerThreadStartMode) OVERRIDE; |
| 56 virtual void terminateWorkerGlobalScope() OVERRIDE; | 57 virtual void terminateWorkerGlobalScope() OVERRIDE; |
| 57 virtual void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue
>, PassOwnPtr<MessagePortChannelArray>) OVERRIDE; | 58 virtual void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue
>, PassOwnPtr<MessagePortChannelArray>) OVERRIDE; |
| 58 virtual bool hasPendingActivity() const OVERRIDE; | 59 virtual bool hasPendingActivity() const OVERRIDE; |
| 59 virtual void workerObjectDestroyed() OVERRIDE; | 60 virtual void workerObjectDestroyed() OVERRIDE; |
| 60 virtual void connectToInspector(WorkerGlobalScopeProxy::PageInspector*) OVER
RIDE; | 61 |
| 62 // Implementations of WorkerInspectorProxy. |
| 63 // (Only use these methods on the worker object thread.) |
| 64 virtual void connectToInspector(WorkerInspectorProxy::PageInspector*) OVERRI
DE; |
| 61 virtual void disconnectFromInspector() OVERRIDE; | 65 virtual void disconnectFromInspector() OVERRIDE; |
| 62 virtual void sendMessageToInspector(const String&) OVERRIDE; | 66 virtual void sendMessageToInspector(const String&) OVERRIDE; |
| 63 virtual void writeTimelineStartedEvent(const String& sessionId) OVERRIDE; | 67 virtual void writeTimelineStartedEvent(const String& sessionId) OVERRIDE; |
| 64 | 68 |
| 65 // These methods come from worker context thread via WorkerObjectProxy | 69 // These methods come from worker context thread via WorkerObjectProxy |
| 66 // and are called on the worker object thread (e.g. main thread). | 70 // and are called on the worker object thread (e.g. main thread). |
| 67 void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, PassOwnPtr
<MessagePortChannelArray>); | 71 void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, PassOwnPtr
<MessagePortChannelArray>); |
| 68 void reportException(const String& errorMessage, int lineNumber, int columnN
umber, const String& sourceURL); | 72 void reportException(const String& errorMessage, int lineNumber, int columnN
umber, const String& sourceURL); |
| 69 void reportConsoleMessage(MessageSource, MessageLevel, const String& message
, int lineNumber, const String& sourceURL); | 73 void reportConsoleMessage(MessageSource, MessageLevel, const String& message
, int lineNumber, const String& sourceURL); |
| 70 void postMessageToPageInspector(const String&); | 74 void postMessageToPageInspector(const String&); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 93 Worker* m_workerObject; | 97 Worker* m_workerObject; |
| 94 bool m_mayBeDestroyed; | 98 bool m_mayBeDestroyed; |
| 95 RefPtr<DedicatedWorkerThread> m_workerThread; | 99 RefPtr<DedicatedWorkerThread> m_workerThread; |
| 96 | 100 |
| 97 unsigned m_unconfirmedMessageCount; // Unconfirmed messages from worker obje
ct to worker thread. | 101 unsigned m_unconfirmedMessageCount; // Unconfirmed messages from worker obje
ct to worker thread. |
| 98 bool m_workerThreadHadPendingActivity; // The latest confirmation from worke
r thread reported that it was still active. | 102 bool m_workerThreadHadPendingActivity; // The latest confirmation from worke
r thread reported that it was still active. |
| 99 | 103 |
| 100 bool m_askedToTerminate; | 104 bool m_askedToTerminate; |
| 101 | 105 |
| 102 Vector<OwnPtr<ExecutionContextTask> > m_queuedEarlyTasks; // Tasks are queue
d here until there's a thread object created. | 106 Vector<OwnPtr<ExecutionContextTask> > m_queuedEarlyTasks; // Tasks are queue
d here until there's a thread object created. |
| 103 WorkerGlobalScopeProxy::PageInspector* m_pageInspector; | 107 WorkerInspectorProxy::PageInspector* m_pageInspector; |
| 104 | 108 |
| 105 OwnPtrWillBePersistent<WorkerClients> m_workerClients; | 109 OwnPtrWillBePersistent<WorkerClients> m_workerClients; |
| 106 }; | 110 }; |
| 107 | 111 |
| 108 } // namespace blink | 112 } // namespace blink |
| 109 | 113 |
| 110 #endif // WorkerMessagingProxy_h | 114 #endif // WorkerMessagingProxy_h |
| OLD | NEW |