Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: Source/core/workers/WorkerThread.h

Issue 956333002: Refactor TimeBase to post tasks. Workers to use real Idle tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix a bunch of stuff Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 29 matching lines...) Expand all
40 #include "wtf/PassRefPtr.h" 40 #include "wtf/PassRefPtr.h"
41 #include "wtf/RefCounted.h" 41 #include "wtf/RefCounted.h"
42 #include <v8.h> 42 #include <v8.h>
43 43
44 namespace blink { 44 namespace blink {
45 45
46 class WebWaitableEvent; 46 class WebWaitableEvent;
47 class WorkerGlobalScope; 47 class WorkerGlobalScope;
48 class WorkerInspectorController; 48 class WorkerInspectorController;
49 class WorkerReportingProxy; 49 class WorkerReportingProxy;
50 class WorkerSharedTimer;
51 class WorkerThreadShutdownFinishTask; 50 class WorkerThreadShutdownFinishTask;
52 class WorkerThreadStartupData; 51 class WorkerThreadStartupData;
53 class WorkerThreadTask; 52 class WorkerThreadTask;
54 53
55 enum WorkerThreadStartMode { 54 enum WorkerThreadStartMode {
56 DontPauseWorkerGlobalScopeOnStart, 55 DontPauseWorkerGlobalScopeOnStart,
57 PauseWorkerGlobalScopeOnStart 56 PauseWorkerGlobalScopeOnStart
58 }; 57 };
59 58
60 class WorkerThread : public RefCounted<WorkerThread> { 59 class WorkerThread : public RefCounted<WorkerThread> {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 110
112 protected: 111 protected:
113 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPt rWillBeRawPtr<WorkerThreadStartupData>); 112 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPt rWillBeRawPtr<WorkerThreadStartupData>);
114 113
115 // Factory method for creating a new worker context for the thread. 114 // Factory method for creating a new worker context for the thread.
116 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa ssOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0; 115 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa ssOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0;
117 116
118 virtual void postInitialize() { } 117 virtual void postInitialize() { }
119 118
120 private: 119 private:
121 friend class WorkerSharedTimer;
122 friend class WorkerThreadShutdownFinishTask; 120 friend class WorkerThreadShutdownFinishTask;
123 121
124 void stopInShutdownSequence(); 122 void stopInShutdownSequence();
125 void stopInternal(); 123 void stopInternal();
126 124
127 void initialize(); 125 void initialize();
128 void cleanup(); 126 void cleanup();
129 void idleHandler(); 127 void idleHandler();
130 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); 128 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs);
131 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas k>, long long delayMs); 129 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas k>, long long delayMs);
132 v8::Isolate* initializeIsolate(); 130 v8::Isolate* initializeIsolate();
133 void terminateV8Execution(); 131 void terminateV8Execution();
134 132
135 bool m_terminated; 133 bool m_terminated;
136 OwnPtr<WorkerSharedTimer> m_sharedTimer;
137 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; 134 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue;
138 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; 135 OwnPtr<WebThread::TaskObserver> m_microtaskRunner;
139 136
140 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; 137 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy;
141 WorkerReportingProxy& m_workerReportingProxy; 138 WorkerReportingProxy& m_workerReportingProxy;
142 139
143 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle r; 140 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle r;
144 Mutex m_workerInspectorControllerMutex; 141 Mutex m_workerInspectorControllerMutex;
145 142
146 Mutex m_threadCreationMutex; 143 Mutex m_threadCreationMutex;
(...skipping 13 matching lines...) Expand all
160 // WorkerThread might get deleted before it had a chance to properly 157 // WorkerThread might get deleted before it had a chance to properly
161 // shut down. By deleting the WebThread first, we can guarantee that 158 // shut down. By deleting the WebThread first, we can guarantee that
162 // no pending tasks on the thread might want to access any of the other 159 // no pending tasks on the thread might want to access any of the other
163 // members during the WorkerThread's destruction. 160 // members during the WorkerThread's destruction.
164 OwnPtr<WebThreadSupportingGC> m_thread; 161 OwnPtr<WebThreadSupportingGC> m_thread;
165 }; 162 };
166 163
167 } // namespace blink 164 } // namespace blink
168 165
169 #endif // WorkerThread_h 166 #endif // WorkerThread_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698