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

Side by Side Diff: Source/core/workers/WorkerRunLoop.cpp

Issue 219003002: [ABANDONED] Call Microtask::performCheckpoint for each worker task. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: PS2 (with additional comments) Created 6 years, 8 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
« no previous file with comments | « Source/bindings/v8/WorkerScriptController.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/workers/WorkerRunLoop.h" 32 #include "core/workers/WorkerRunLoop.h"
33 33
34 #include "core/dom/Microtask.h"
34 #include "core/inspector/InspectorInstrumentation.h" 35 #include "core/inspector/InspectorInstrumentation.h"
35 #include "core/workers/WorkerGlobalScope.h" 36 #include "core/workers/WorkerGlobalScope.h"
36 #include "core/workers/WorkerThread.h" 37 #include "core/workers/WorkerThread.h"
37 #include "platform/PlatformThreadData.h" 38 #include "platform/PlatformThreadData.h"
38 #include "platform/SharedTimer.h" 39 #include "platform/SharedTimer.h"
39 #include "platform/ThreadTimers.h" 40 #include "platform/ThreadTimers.h"
40 #include "platform/heap/ThreadState.h" 41 #include "platform/heap/ThreadState.h"
41 #include "wtf/CurrentTime.h" 42 #include "wtf/CurrentTime.h"
42 43
43 namespace WebCore { 44 namespace WebCore {
44 45
45 class WorkerRunLoopTask : public blink::WebThread::Task { 46 class WorkerRunLoopTask : public blink::WebThread::Task {
46 WTF_MAKE_NONCOPYABLE(WorkerRunLoopTask); WTF_MAKE_FAST_ALLOCATED; 47 WTF_MAKE_NONCOPYABLE(WorkerRunLoopTask); WTF_MAKE_FAST_ALLOCATED;
47 public: 48 public:
48 static PassOwnPtr<WorkerRunLoopTask> create(const WorkerRunLoop& runLoop, Pa ssOwnPtr<ExecutionContextTask> task) 49 static PassOwnPtr<WorkerRunLoopTask> create(const WorkerRunLoop& runLoop, Pa ssOwnPtr<ExecutionContextTask> task)
49 { 50 {
50 return adoptPtr(new WorkerRunLoopTask(runLoop, task)); 51 return adoptPtr(new WorkerRunLoopTask(runLoop, task));
51 } 52 }
52 53
53 virtual ~WorkerRunLoopTask() { } 54 virtual ~WorkerRunLoopTask() { }
54 55
55 virtual void run() OVERRIDE 56 virtual void run() OVERRIDE
56 { 57 {
57 WorkerGlobalScope* workerGlobalScope = m_runLoop.context(); 58 WorkerGlobalScope* workerGlobalScope = m_runLoop.context();
58 if ((!workerGlobalScope->isClosing() && !m_runLoop.terminated()) || m_ta sk->isCleanupTask()) 59 if ((!workerGlobalScope->isClosing() && !m_runLoop.terminated()) || m_ta sk->isCleanupTask())
59 m_task->performTask(workerGlobalScope); 60 m_task->performTask(workerGlobalScope);
61 if (!workerGlobalScope->isClosing() && !m_runLoop.terminated())
62 Microtask::performCheckpoint();
60 } 63 }
61 64
62 private: 65 private:
63 WorkerRunLoopTask(const WorkerRunLoop& runLoop, PassOwnPtr<ExecutionContextT ask> task) 66 WorkerRunLoopTask(const WorkerRunLoop& runLoop, PassOwnPtr<ExecutionContextT ask> task)
64 : m_runLoop(runLoop) 67 : m_runLoop(runLoop)
65 , m_task(task) 68 , m_task(task)
66 { 69 {
67 } 70 }
68 71
69 const WorkerRunLoop& m_runLoop; 72 const WorkerRunLoop& m_runLoop;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 266 }
264 267
265 void WorkerRunLoop::postTaskAndTerminate(PassOwnPtr<ExecutionContextTask> task) 268 void WorkerRunLoop::postTaskAndTerminate(PassOwnPtr<ExecutionContextTask> task)
266 { 269 {
267 m_debuggerMessageQueue.kill(); 270 m_debuggerMessageQueue.kill();
268 m_messageQueue.appendAndKill(WorkerRunLoopTask::create(*this, task)); 271 m_messageQueue.appendAndKill(WorkerRunLoopTask::create(*this, task));
269 } 272 }
270 273
271 bool WorkerRunLoop::postDebuggerTask(PassOwnPtr<ExecutionContextTask> task) 274 bool WorkerRunLoop::postDebuggerTask(PassOwnPtr<ExecutionContextTask> task)
272 { 275 {
273 bool posted = m_debuggerMessageQueue.append(WorkerRunLoopTask::create(*this, task)); 276 bool posted = m_debuggerMessageQueue.append(WorkerRunLoopTask::create(*this, task));
jochen (gone - plz use gerrit) 2014/04/08 07:48:57 here, a debugger task is queued in a separate mess
274 if (posted) 277 if (posted)
275 postTask(TickleDebuggerQueueTask::create(this)); 278 postTask(TickleDebuggerQueueTask::create(this));
jochen (gone - plz use gerrit) 2014/04/08 07:48:57 and here, we post a tickle debugger queue task on
yhirano 2014/04/09 05:39:02 TickleDebuggerQueueTask inherits ExecutionContextT
276 return posted; 279 return posted;
277 } 280 }
278 281
279 } // namespace WebCore 282 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/WorkerScriptController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698