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 |
131 private: | 134 private: |
132 friend class WorkerSharedTimer; | 135 friend class WorkerSharedTimer; |
| 136 friend class WorkerThreadIdleTask; |
133 friend class WorkerMicrotaskRunner; | 137 friend class WorkerMicrotaskRunner; |
134 | 138 |
135 void stopInShutdownSequence(); | 139 void stopInShutdownSequence(); |
136 void stopInternal(); | 140 void stopInternal(); |
137 | 141 |
138 void initialize(); | 142 void initialize(); |
139 void cleanup(); | 143 void cleanup(); |
140 void idleHandler(); | 144 void performIdleWork(double deadlineSeconds); |
141 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); | 145 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); |
142 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas
k>, long long delayMs); | 146 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas
k>, long long delayMs); |
143 | 147 |
144 bool m_started; | 148 bool m_started; |
145 bool m_terminated; | 149 bool m_terminated; |
146 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; | 150 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; |
147 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; | 151 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; |
148 | 152 |
149 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; | 153 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; |
150 WorkerReportingProxy& m_workerReportingProxy; | 154 WorkerReportingProxy& m_workerReportingProxy; |
| 155 RawPtr<WebScheduler> m_webScheduler; |
151 | 156 |
152 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle
r; | 157 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle
r; |
153 Mutex m_workerInspectorControllerMutex; | 158 Mutex m_workerInspectorControllerMutex; |
154 | 159 |
155 Mutex m_threadCreationMutex; | 160 Mutex m_threadCreationMutex; |
156 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; | 161 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
157 OwnPtr<WorkerThreadStartupData> m_startupData; | 162 OwnPtr<WorkerThreadStartupData> m_startupData; |
158 | 163 |
159 v8::Isolate* m_isolate; | 164 v8::Isolate* m_isolate; |
160 OwnPtr<V8IsolateInterruptor> m_interruptor; | 165 OwnPtr<V8IsolateInterruptor> m_interruptor; |
161 | 166 |
162 // Used to signal thread shutdown. | 167 // Used to signal thread shutdown. |
163 OwnPtr<WebWaitableEvent> m_shutdownEvent; | 168 OwnPtr<WebWaitableEvent> m_shutdownEvent; |
164 | 169 |
165 // Used to signal thread termination. | 170 // Used to signal thread termination. |
166 OwnPtr<WebWaitableEvent> m_terminationEvent; | 171 OwnPtr<WebWaitableEvent> m_terminationEvent; |
167 }; | 172 }; |
168 | 173 |
169 } // namespace blink | 174 } // namespace blink |
170 | 175 |
171 #endif // WorkerThread_h | 176 #endif // WorkerThread_h |
OLD | NEW |