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 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
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/DedicatedWorkerThread.h" |
| 32 #include "core/workers/WorkerGlobalScope.h" |
31 #include "core/workers/WorkerGlobalScopeProxy.h" | 33 #include "core/workers/WorkerGlobalScopeProxy.h" |
32 #include "core/workers/WorkerLoaderProxy.h" | 34 #include "core/workers/WorkerLoaderProxy.h" |
33 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
34 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
35 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
36 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
37 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
38 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
39 | 41 |
40 namespace blink { | 42 namespace blink { |
41 | 43 |
42 class WorkerObjectProxy; | 44 class WorkerObjectProxy; |
43 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 { |
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. |
(...skipping 18 matching lines...) Expand all Loading... |
72 void workerGlobalScopeClosed(); | 73 void workerGlobalScopeClosed(); |
73 void workerGlobalScopeDestroyed(); | 74 void workerGlobalScopeDestroyed(); |
74 | 75 |
75 // Implementation of WorkerLoaderProxy. | 76 // Implementation of WorkerLoaderProxy. |
76 // These methods are called on different threads to schedule loading | 77 // These methods are called on different threads to schedule loading |
77 // requests and to send callbacks back to WorkerGlobalScope. | 78 // requests and to send callbacks back to WorkerGlobalScope. |
78 virtual void postTaskToLoader(PassOwnPtr<ExecutionContextTask>) OVERRIDE; | 79 virtual void postTaskToLoader(PassOwnPtr<ExecutionContextTask>) OVERRIDE; |
79 virtual bool postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionContextTask>) O
VERRIDE; | 80 virtual bool postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionContextTask>) O
VERRIDE; |
80 | 81 |
81 void workerThreadCreated(PassRefPtr<DedicatedWorkerThread>); | 82 void workerThreadCreated(PassRefPtr<DedicatedWorkerThread>); |
82 | 83 WorkerGlobalScope* extractWorkerGlobalScope(); |
83 protected: | 84 protected: |
84 virtual ~WorkerMessagingProxy(); | 85 virtual ~WorkerMessagingProxy(); |
85 | 86 |
86 private: | 87 private: |
87 static void workerObjectDestroyedInternal(ExecutionContext*, WorkerMessaging
Proxy*); | 88 static void workerObjectDestroyedInternal(ExecutionContext*, WorkerMessaging
Proxy*); |
88 | |
89 RefPtrWillBePersistent<ExecutionContext> m_executionContext; | 89 RefPtrWillBePersistent<ExecutionContext> m_executionContext; |
90 OwnPtr<WorkerObjectProxy> m_workerObjectProxy; | 90 OwnPtr<WorkerObjectProxy> m_workerObjectProxy; |
91 Worker* m_workerObject; | 91 Worker* m_workerObject; |
92 bool m_mayBeDestroyed; | 92 bool m_mayBeDestroyed; |
93 RefPtr<DedicatedWorkerThread> m_workerThread; | 93 RefPtr<DedicatedWorkerThread> m_workerThread; |
94 | |
95 unsigned m_unconfirmedMessageCount; // Unconfirmed messages from worker obje
ct to worker thread. | 94 unsigned m_unconfirmedMessageCount; // Unconfirmed messages from worker obje
ct to worker thread. |
96 bool m_workerThreadHadPendingActivity; // The latest confirmation from worke
r thread reported that it was still active. | 95 bool m_workerThreadHadPendingActivity; // The latest confirmation from worke
r thread reported that it was still active. |
97 | 96 |
98 bool m_askedToTerminate; | 97 bool m_askedToTerminate; |
99 | 98 |
100 Vector<OwnPtr<ExecutionContextTask> > m_queuedEarlyTasks; // Tasks are queue
d here until there's a thread object created. | 99 Vector<OwnPtr<ExecutionContextTask> > m_queuedEarlyTasks; // Tasks are queue
d here until there's a thread object created. |
101 WorkerGlobalScopeProxy::PageInspector* m_pageInspector; | 100 WorkerGlobalScopeProxy::PageInspector* m_pageInspector; |
102 | 101 |
103 OwnPtrWillBePersistent<WorkerClients> m_workerClients; | 102 OwnPtrWillBePersistent<WorkerClients> m_workerClients; |
104 }; | 103 }; |
105 | 104 |
106 } // namespace blink | 105 } // namespace blink |
107 | 106 |
108 #endif // WorkerMessagingProxy_h | 107 #endif // WorkerMessagingProxy_h |
OLD | NEW |