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