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

Issue 219003002: [ABANDONED] Call Microtask::performCheckpoint for each worker task. (Closed)

Created:
6 years, 8 months ago by yhirano
Modified:
6 years, 8 months ago
CC:
blink-reviews, falken, horo+watch_chromium.org, kinuko+watch
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Call Microtask::performCheckpoint for each worker task. In order to run Promise microtasks in workers, we need to call Microtask::performCheckpoint at the end of each task. This CL does that. BUG=352552 R=adamk@chromium.org

Patch Set 1 #

Patch Set 2 : Call ensureDomInJSContext #

Total comments: 1

Patch Set 3 : Detect the termination after the fact #

Patch Set 4 : rebase; add a comment #

Patch Set 5 : #

Total comments: 2

Patch Set 6 : PS2 (with additional comments) #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -0 lines) Patch
M Source/bindings/v8/WorkerScriptController.cpp View 1 2 3 4 5 1 chunk +10 lines, -0 lines 0 comments Download
M Source/core/workers/WorkerRunLoop.cpp View 1 2 3 2 chunks +3 lines, -0 lines 3 comments Download

Messages

Total messages: 19 (0 generated)
yhirano
6 years, 8 months ago (2014-03-31 07:19:56 UTC) #1
adamk
As I noted in the bug the call to performCheckpoint seems reasonable to me, but ...
6 years, 8 months ago (2014-03-31 15:27:36 UTC) #2
adamk
Adding rafaelw
6 years, 8 months ago (2014-03-31 16:17:26 UTC) #3
yhirano
On 2014/03/31 15:27:36, adamk wrote: > As I noted in the bug the call to ...
6 years, 8 months ago (2014-04-01 02:29:12 UTC) #4
adamk
On 2014/04/01 02:29:12, yhirano wrote: > On 2014/03/31 15:27:36, adamk wrote: > > As I ...
6 years, 8 months ago (2014-04-01 21:59:38 UTC) #5
yhirano
> Looking at that error message I see "Error installing extension 'v8/gc'". The v8 > ...
6 years, 8 months ago (2014-04-04 04:23:10 UTC) #6
yhirano
One more thing: Microtask::performCheckPoint uses V8PerIsolateData::ensureDomInJSContext and it leads to a crash. A V8PerIsolateData has ...
6 years, 8 months ago (2014-04-04 11:58:33 UTC) #7
yhirano
On 2014/04/04 11:58:33, yhirano wrote: > One more thing: Microtask::performCheckPoint uses > V8PerIsolateData::ensureDomInJSContext and it ...
6 years, 8 months ago (2014-04-04 12:07:05 UTC) #8
adamk
On 2014/04/04 04:23:10, yhirano wrote: > > Looking at that error message I see "Error ...
6 years, 8 months ago (2014-04-04 22:36:35 UTC) #9
yhirano
On 2014/04/04 22:36:35, adamk wrote: > On 2014/04/04 04:23:10, yhirano wrote: > > > Looking ...
6 years, 8 months ago (2014-04-07 01:54:24 UTC) #10
yhirano
> We can check WorkerScriptController::isExecutionTerminating(), but we can't > forbid the main thread from calling ...
6 years, 8 months ago (2014-04-07 03:20:24 UTC) #11
jochen (gone - plz use gerrit)
https://codereview.chromium.org/219003002/diff/80001/Source/core/workers/WorkerRunLoop.cpp File Source/core/workers/WorkerRunLoop.cpp (right): https://codereview.chromium.org/219003002/diff/80001/Source/core/workers/WorkerRunLoop.cpp#newcode62 Source/core/workers/WorkerRunLoop.cpp:62: Microtask::performCheckpoint(); for debugger tasks, this will be executed twice: ...
6 years, 8 months ago (2014-04-07 13:06:35 UTC) #12
adamk
Thank you very much for the detailed explanation of this termination case, and for exploring ...
6 years, 8 months ago (2014-04-07 22:52:49 UTC) #13
yhirano
https://codereview.chromium.org/219003002/diff/80001/Source/core/workers/WorkerRunLoop.cpp File Source/core/workers/WorkerRunLoop.cpp (right): https://codereview.chromium.org/219003002/diff/80001/Source/core/workers/WorkerRunLoop.cpp#newcode62 Source/core/workers/WorkerRunLoop.cpp:62: Microtask::performCheckpoint(); On 2014/04/07 13:06:36, jochen wrote: > for debugger ...
6 years, 8 months ago (2014-04-08 07:35:13 UTC) #14
jochen (gone - plz use gerrit)
https://codereview.chromium.org/219003002/diff/90001/Source/core/workers/WorkerRunLoop.cpp File Source/core/workers/WorkerRunLoop.cpp (right): https://codereview.chromium.org/219003002/diff/90001/Source/core/workers/WorkerRunLoop.cpp#newcode276 Source/core/workers/WorkerRunLoop.cpp:276: bool posted = m_debuggerMessageQueue.append(WorkerRunLoopTask::create(*this, task)); here, a debugger task ...
6 years, 8 months ago (2014-04-08 07:48:57 UTC) #15
yhirano
https://codereview.chromium.org/219003002/diff/90001/Source/core/workers/WorkerRunLoop.cpp File Source/core/workers/WorkerRunLoop.cpp (right): https://codereview.chromium.org/219003002/diff/90001/Source/core/workers/WorkerRunLoop.cpp#newcode278 Source/core/workers/WorkerRunLoop.cpp:278: postTask(TickleDebuggerQueueTask::create(this)); > Both are WorkerRunLoopTasks, and so the checkpoint ...
6 years, 8 months ago (2014-04-09 05:39:02 UTC) #16
jochen (gone - plz use gerrit)
On 2014/04/09 05:39:02, yhirano wrote: > https://codereview.chromium.org/219003002/diff/90001/Source/core/workers/WorkerRunLoop.cpp > File Source/core/workers/WorkerRunLoop.cpp (right): > > https://codereview.chromium.org/219003002/diff/90001/Source/core/workers/WorkerRunLoop.cpp#newcode278 > ...
6 years, 8 months ago (2014-04-09 07:38:47 UTC) #17
yhirano
On 2014/04/09 07:38:47, jochen wrote: > On 2014/04/09 05:39:02, yhirano wrote: > > > https://codereview.chromium.org/219003002/diff/90001/Source/core/workers/WorkerRunLoop.cpp ...
6 years, 8 months ago (2014-04-09 08:09:30 UTC) #18
jochen (gone - plz use gerrit)
6 years, 8 months ago (2014-04-10 07:54:16 UTC) #19
On 2014/04/09 08:09:30, yhirano wrote:
> On 2014/04/09 07:38:47, jochen wrote:
> > On 2014/04/09 05:39:02, yhirano wrote:
> > >
> >
>
https://codereview.chromium.org/219003002/diff/90001/Source/core/workers/Work...
> > > File Source/core/workers/WorkerRunLoop.cpp (right):
> > > 
> > >
> >
>
https://codereview.chromium.org/219003002/diff/90001/Source/core/workers/Work...
> > > Source/core/workers/WorkerRunLoop.cpp:278:
> > > postTask(TickleDebuggerQueueTask::create(this));
> > > > Both are WorkerRunLoopTasks, and so the checkpoint is executed twice at
> the
> > > end
> > > > of the task
> > > 
> > > TickleDebuggerQueueTask inherits ExecutionContextTask, not
> WorkerRunLoopTask.
> > 
> > Right, but the postTask will wrap it in a WorkerRunLoopTask
> Oh, I see, thank you.
> Then, there are many WorkerRunLoopTasks, namely:
> task: the given task (in postDebuggerTask) which is pushed on the debugger
> queue.
> task1: pop one task (task2) from the debugger queue and run it
> task2: a task in the debugger queue, run by task1
> 
> task == task2 doesn't always hold, does it?

correct

> 
> The execution might be:
>   task1->run
>    task1->m_task->performTask
>     loop->runDebuggerTask
>      task2->run
>       task2->m_task->performTask
>       Microtask::performCheckpoint
>    Microtask::performCheckpoint
> 
> There seems no problem.
> Because Microtask::performCheckpoint consumes all pending microtasks and task1
> merely executes task2, the inner performCheckpoint executes microtasks posted
by
> task2 and the outer performCheckpoint does nothing.

great

Powered by Google App Engine
This is Rietveld 408576698