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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 bool isCurrentThread(); | 89 bool isCurrentThread(); |
90 WorkerLoaderProxy* workerLoaderProxy() const | 90 WorkerLoaderProxy* workerLoaderProxy() const |
91 { | 91 { |
92 RELEASE_ASSERT(m_workerLoaderProxy); | 92 RELEASE_ASSERT(m_workerLoaderProxy); |
93 return m_workerLoaderProxy.get(); | 93 return m_workerLoaderProxy.get(); |
94 } | 94 } |
95 | 95 |
96 WorkerReportingProxy& workerReportingProxy() const { return m_workerReportin
gProxy; } | 96 WorkerReportingProxy& workerReportingProxy() const { return m_workerReportin
gProxy; } |
97 | 97 |
98 void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>); | 98 void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>); |
99 void appendDebuggerTask(PassOwnPtr<WebThread::Task>); | 99 void appendDebuggerTask(PassOwnPtr<WebTaskRunner::Task>); |
100 | 100 |
101 enum WaitMode { WaitForMessage, DontWaitForMessage }; | 101 enum WaitMode { WaitForMessage, DontWaitForMessage }; |
102 MessageQueueWaitResult runDebuggerTask(WaitMode = WaitForMessage); | 102 MessageQueueWaitResult runDebuggerTask(WaitMode = WaitForMessage); |
103 | 103 |
104 // These methods should be called if the holder of the thread is | 104 // These methods should be called if the holder of the thread is |
105 // going to call runDebuggerTask in a loop. | 105 // going to call runDebuggerTask in a loop. |
106 void willEnterNestedLoop(); | 106 void willEnterNestedLoop(); |
107 void didLeaveNestedLoop(); | 107 void didLeaveNestedLoop(); |
108 | 108 |
109 // Can be called only on the worker thread, WorkerGlobalScope is not thread
safe. | 109 // Can be called only on the worker thread, WorkerGlobalScope is not thread
safe. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Called on the worker thread. | 149 // Called on the worker thread. |
150 void initialize(PassOwnPtr<WorkerThreadStartupData>); | 150 void initialize(PassOwnPtr<WorkerThreadStartupData>); |
151 void shutdown(); | 151 void shutdown(); |
152 void performShutdownTask(); | 152 void performShutdownTask(); |
153 void performIdleWork(double deadlineSeconds); | 153 void performIdleWork(double deadlineSeconds); |
154 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas
k>, long long delayMs); | 154 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas
k>, long long delayMs); |
155 | 155 |
156 bool m_started; | 156 bool m_started; |
157 bool m_terminated; | 157 bool m_terminated; |
158 bool m_shutdown; | 158 bool m_shutdown; |
159 MessageQueue<WebThread::Task> m_debuggerMessageQueue; | 159 MessageQueue<WebTaskRunner::Task> m_debuggerMessageQueue; |
160 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; | 160 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; |
161 | 161 |
162 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; | 162 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; |
163 WorkerReportingProxy& m_workerReportingProxy; | 163 WorkerReportingProxy& m_workerReportingProxy; |
164 RawPtr<WebScheduler> m_webScheduler; // Not owned. | 164 RawPtr<WebScheduler> m_webScheduler; // Not owned. |
165 | 165 |
166 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle
r; | 166 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle
r; |
167 Mutex m_workerInspectorControllerMutex; | 167 Mutex m_workerInspectorControllerMutex; |
168 | 168 |
169 // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_isolate| and
|m_microtaskRunner|. | 169 // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_isolate| and
|m_microtaskRunner|. |
170 Mutex m_threadStateMutex; | 170 Mutex m_threadStateMutex; |
171 | 171 |
172 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; | 172 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
173 | 173 |
174 v8::Isolate* m_isolate; | 174 v8::Isolate* m_isolate; |
175 | 175 |
176 // Used to signal thread shutdown. | 176 // Used to signal thread shutdown. |
177 OwnPtr<WebWaitableEvent> m_shutdownEvent; | 177 OwnPtr<WebWaitableEvent> m_shutdownEvent; |
178 | 178 |
179 // Used to signal thread termination. | 179 // Used to signal thread termination. |
180 OwnPtr<WebWaitableEvent> m_terminationEvent; | 180 OwnPtr<WebWaitableEvent> m_terminationEvent; |
181 }; | 181 }; |
182 | 182 |
183 } // namespace blink | 183 } // namespace blink |
184 | 184 |
185 #endif // WorkerThread_h | 185 #endif // WorkerThread_h |
OLD | NEW |