| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Factory method for creating a new worker context for the thread. | 121 // Factory method for creating a new worker context for the thread. |
| 122 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa
ssOwnPtr<WorkerThreadStartupData>) = 0; | 122 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa
ssOwnPtr<WorkerThreadStartupData>) = 0; |
| 123 | 123 |
| 124 virtual void postInitialize() { } | 124 virtual void postInitialize() { } |
| 125 | 125 |
| 126 virtual v8::Isolate* initializeIsolate(); | 126 virtual v8::Isolate* initializeIsolate(); |
| 127 virtual void willDestroyIsolate(); | 127 virtual void willDestroyIsolate(); |
| 128 virtual void destroyIsolate(); | 128 virtual void destroyIsolate(); |
| 129 virtual void terminateV8Execution(); | 129 virtual void terminateV8Execution(); |
| 130 | 130 |
| 131 // This is protected virtual for testing. | |
| 132 virtual bool doIdleGc(double deadlineSeconds); | |
| 133 | |
| 134 private: | 131 private: |
| 135 friend class WorkerSharedTimer; | 132 friend class WorkerSharedTimer; |
| 136 friend class WorkerThreadIdleTask; | |
| 137 friend class WorkerMicrotaskRunner; | 133 friend class WorkerMicrotaskRunner; |
| 138 | 134 |
| 139 void stopInShutdownSequence(); | 135 void stopInShutdownSequence(); |
| 140 void stopInternal(); | 136 void stopInternal(); |
| 141 | 137 |
| 142 void initialize(); | 138 void initialize(); |
| 143 void shutdown(); | 139 void shutdown(); |
| 144 void performIdleWork(double deadlineSeconds); | 140 void idleHandler(); |
| 145 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); | 141 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); |
| 146 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas
k>, long long delayMs); | 142 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas
k>, long long delayMs); |
| 147 | 143 |
| 148 bool m_started; | 144 bool m_started; |
| 149 bool m_terminated; | 145 bool m_terminated; |
| 150 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; | 146 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; |
| 151 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; | 147 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; |
| 152 | 148 |
| 153 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; | 149 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; |
| 154 WorkerReportingProxy& m_workerReportingProxy; | 150 WorkerReportingProxy& m_workerReportingProxy; |
| 155 RawPtr<WebScheduler> m_webScheduler; // Not owned. | |
| 156 | 151 |
| 157 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle
r; | 152 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle
r; |
| 158 Mutex m_workerInspectorControllerMutex; | 153 Mutex m_workerInspectorControllerMutex; |
| 159 | 154 |
| 160 // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_isolate| and
|m_microtaskRunner|. | 155 // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_isolate| and
|m_microtaskRunner|. |
| 161 Mutex m_threadStateMutex; | 156 Mutex m_threadStateMutex; |
| 162 | 157 |
| 163 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; | 158 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
| 164 OwnPtr<WorkerThreadStartupData> m_startupData; | 159 OwnPtr<WorkerThreadStartupData> m_startupData; |
| 165 | 160 |
| 166 v8::Isolate* m_isolate; | 161 v8::Isolate* m_isolate; |
| 167 OwnPtr<V8IsolateInterruptor> m_interruptor; | 162 OwnPtr<V8IsolateInterruptor> m_interruptor; |
| 168 | 163 |
| 169 // Used to signal thread shutdown. | 164 // Used to signal thread shutdown. |
| 170 OwnPtr<WebWaitableEvent> m_shutdownEvent; | 165 OwnPtr<WebWaitableEvent> m_shutdownEvent; |
| 171 | 166 |
| 172 // Used to signal thread termination. | 167 // Used to signal thread termination. |
| 173 OwnPtr<WebWaitableEvent> m_terminationEvent; | 168 OwnPtr<WebWaitableEvent> m_terminationEvent; |
| 174 }; | 169 }; |
| 175 | 170 |
| 176 } // namespace blink | 171 } // namespace blink |
| 177 | 172 |
| 178 #endif // WorkerThread_h | 173 #endif // WorkerThread_h |
| OLD | NEW |