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

Issue 2177243002: Use per-frame TaskRunner instead of thread's default in DataConsumerHandle (Closed)

Created:
4 years, 5 months ago by tzik
Modified:
3 years, 9 months ago
Reviewers:
haraken, kinuko, Sami, yhirano
CC:
chromium-reviews, blink-reviews-dom_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, ben+mojo_chromium.org, sof, jam, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, dglazkov+blink, darin-cc_chromium.org, eae+blinkwatch, blink-reviews, darin (slow to review), scheduler-bugs_chromium.org, blink-reviews-api_chromium.org, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@data_consumer_handle_unique_ptr
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use per-frame TaskRunner instead of thread's default in DataConsumerHandle This CL adds an WebTaskRunner parameter to DataConsumerHandle::obtainReader and removes access to the thread's default task runner in favor to use per-frame task runner. BUG=624696

Patch Set 1 #

Patch Set 2 : update #

Patch Set 3 : update #

Patch Set 4 : update #

Patch Set 5 : update #

Total comments: 2

Patch Set 6 : -WebTaskRunner from ReadableStreamDataConsumerHandle #

Patch Set 7 : move task runners from obtainReader to Client #

Patch Set 8 : revert no-longer-needed changes #

Patch Set 9 : revert more #

Patch Set 10 : test fix #

Total comments: 8

Patch Set 11 : another test fix #

Patch Set 12 : update #

Patch Set 13 : webkit_unit_tests fix #

Patch Set 14 : update #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+278 lines, -110 lines) Patch
M components/scheduler/child/web_task_runner_impl.h View 1 2 3 2 chunks +7 lines, -0 lines 0 comments Download
M components/scheduler/child/web_task_runner_impl.cc View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
M content/child/shared_memory_data_consumer_handle.cc View 1 2 3 4 5 6 7 8 9 2 chunks +10 lines, -1 line 1 comment Download
M content/child/shared_memory_data_consumer_handle_unittest.cc View 1 2 3 4 5 6 7 8 9 5 chunks +7 lines, -0 lines 0 comments Download
M content/child/web_data_consumer_handle_impl.cc View 1 2 3 4 5 6 2 chunks +18 lines, -1 line 1 comment Download
M content/child/web_data_consumer_handle_impl_unittest.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/cachestorage/Cache.cpp View 1 2 3 4 5 6 3 chunks +11 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/Body.cpp View 1 2 3 4 5 6 2 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +21 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +21 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +21 lines, -22 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 11 chunks +29 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 9 chunks +29 lines, -15 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.cpp View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp View 1 2 3 4 5 6 7 8 9 10 11 7 chunks +10 lines, -20 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/FetchDataLoader.h View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/FetchDataLoader.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 chunks +45 lines, -22 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/FetchManager.cpp View 1 2 3 4 5 6 2 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +5 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/ResponseTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +2 lines, -11 lines 0 comments Download
M third_party/WebKit/public/platform/WebDataConsumerHandle.h View 1 2 3 4 5 6 2 chunks +4 lines, -0 lines 1 comment Download

Messages

Total messages: 62 (44 generated)
tzik
PTAL to: yhirano: modules/fetch stuff, haraken: overall, skyostil: //component/scheduler, kinuko: //content/child, if you have time.
4 years, 4 months ago (2016-07-27 09:55:36 UTC) #13
haraken
Thanks for the CL! Hmm, it looks like this CL is passing task runners a ...
4 years, 4 months ago (2016-07-27 11:05:25 UTC) #16
tzik
https://codereview.chromium.org/2177243002/diff/80001/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp File third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp (right): https://codereview.chromium.org/2177243002/diff/80001/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp#newcode246 third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp:246: m_readerTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(&ReadingContext::notify, PassRefPtr<ReadingContext>(this))); On 2016/07/27 11:05:25, haraken wrote: > ...
4 years, 4 months ago (2016-07-27 14:59:41 UTC) #21
haraken
On 2016/07/27 14:59:41, tzik wrote: > https://codereview.chromium.org/2177243002/diff/80001/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp > File > third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp > (right): > > ...
4 years, 4 months ago (2016-07-27 15:42:14 UTC) #24
tzik
On 2016/07/27 15:42:14, haraken wrote: > On 2016/07/27 14:59:41, tzik wrote: > > > https://codereview.chromium.org/2177243002/diff/80001/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp ...
4 years, 4 months ago (2016-07-28 07:17:19 UTC) #31
haraken
Thanks, this looks much nicer! https://codereview.chromium.org/2177243002/diff/180001/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp File third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp (right): https://codereview.chromium.org/2177243002/diff/180001/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp#newcode150 third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp:150: std::unique_ptr<WebTaskRunner> m_readerTaskRunner; Instead of ...
4 years, 4 months ago (2016-07-28 09:19:30 UTC) #40
Sami
On 2016/07/27 15:42:14, haraken wrote: > Sorry, I believe I should have clarified this earlier... ...
4 years, 4 months ago (2016-07-28 14:28:12 UTC) #47
tzik
https://codereview.chromium.org/2177243002/diff/180001/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp File third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp (right): https://codereview.chromium.org/2177243002/diff/180001/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp#newcode150 third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp:150: std::unique_ptr<WebTaskRunner> m_readerTaskRunner; On 2016/07/28 09:19:30, haraken wrote: > > ...
4 years, 4 months ago (2016-07-28 14:45:34 UTC) #50
haraken
On 2016/07/28 14:28:12, Sami wrote: > On 2016/07/27 15:42:14, haraken wrote: > > Sorry, I ...
4 years, 4 months ago (2016-07-28 15:16:55 UTC) #51
kinuko
On 2016/07/28 15:16:55, haraken wrote: > On 2016/07/28 14:28:12, Sami wrote: > > On 2016/07/27 ...
4 years, 4 months ago (2016-07-28 15:41:15 UTC) #52
kinuko
https://codereview.chromium.org/2177243002/diff/260001/content/child/shared_memory_data_consumer_handle.cc File content/child/shared_memory_data_consumer_handle.cc (right): https://codereview.chromium.org/2177243002/diff/260001/content/child/shared_memory_data_consumer_handle.cc#newcode128 content/child/shared_memory_data_consumer_handle.cc:128: scheduler::WebTaskRunnerImpl::GetBaseTaskRunner(*task_runner); Per Sami's comment this would be a tentative ...
4 years, 4 months ago (2016-07-28 15:41:31 UTC) #53
haraken
On 2016/07/28 15:41:15, kinuko wrote: > On 2016/07/28 15:16:55, haraken wrote: > > On 2016/07/28 ...
4 years, 4 months ago (2016-07-28 16:02:17 UTC) #54
yhirano
As I talked offline, I'm deprecating most of WebDataConsumerHandle implementations (crbug.com/610195) and am not happy ...
4 years, 4 months ago (2016-07-28 16:25:06 UTC) #57
Sami
On 2016/07/28 15:16:55, haraken wrote: > The migration of scheduler/ makes things a lot easier ...
4 years, 4 months ago (2016-07-28 17:10:08 UTC) #58
yhirano
On 2016/07/28 07:17:19, tzik wrote: > On 2016/07/27 15:42:14, haraken wrote: > > On 2016/07/27 ...
4 years, 4 months ago (2016-07-29 02:30:38 UTC) #59
haraken
On 2016/07/29 02:30:38, yhirano wrote: > On 2016/07/28 07:17:19, tzik wrote: > > On 2016/07/27 ...
4 years, 4 months ago (2016-07-29 08:49:41 UTC) #60
yhirano
On 2016/07/29 08:49:41, haraken wrote: > On 2016/07/29 02:30:38, yhirano wrote: > > On 2016/07/28 ...
4 years, 4 months ago (2016-07-29 09:08:41 UTC) #61
haraken
4 years, 4 months ago (2016-07-29 09:34:52 UTC) #62
On 2016/07/29 09:08:41, yhirano wrote:
> On 2016/07/29 08:49:41, haraken wrote:
> > On 2016/07/29 02:30:38, yhirano wrote:
> > > On 2016/07/28 07:17:19, tzik wrote:
> > > > On 2016/07/27 15:42:14, haraken wrote:
> > > > > On 2016/07/27 14:59:41, tzik wrote:
> > > > > >
> > > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/2177243002/diff/80001/third_party/WebKit/Sour...
> > > > > > File
> > > > > >
> > >
third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp
> > > > > > (right):
> > > > > > 
> > > > > >
> > > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/2177243002/diff/80001/third_party/WebKit/Sour...
> > > > > >
> > > > >
> > > >
> > >
> >
>
third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp:246:
> > > > > > m_readerTaskRunner->postTask(BLINK_FROM_HERE,
> > > > > WTF::bind(&ReadingContext::notify,
> > > > > > PassRefPtr<ReadingContext>(this)));
> > > > > > On 2016/07/27 11:05:25, haraken wrote:
> > > > > > > 
> > > > > > > For example, you can avoid adding m_readerTaskRunner by using
> > > > > > > TaskRunnerHelper::getUnthrottledTaskRunner(m_scriptState.get()).
> > > > > > 
> > > > > > Done.
> > > > > > Frame/Document/ScriptState seem not available in other use cases.
> > > > > 
> > > > > Sorry, I believe I should have clarified this earlier...
> > > > > 
> > > > > Another important goal of the per-frame scheduler project is to make
> more
> > > > Blink
> > > > > code be aware of Frame (e.g., we've introduced FrameBramer). So we
> prefer
> > > > > passing around LocalFrame/Document/ScriptState than task runners. I
> > > apologize
> > > > I
> > > > > didn't mention this before you spend efforts on creating a large CL :/
> > > > > 
> > > > > In this particular CL, I think we can pass around LocalFrame or
> implement
> > > > > WebDataConsumerHandle::Client::frame(). I want to ask yhirano@'s
> thoughts
> > as
> > > > > well.
> > > > > 
> > > > > It might be better to wait for Sami's comment and confirm that we're
> going
> > > in
> > > > a
> > > > > right direction.
> > > > 
> > > > Updated the CL to add WebDataConsumerHandle::Client::getTaskRunner(),
and
> > > > reverted obtainReader() part.
> > > > Since the interface is implemented in content/ too, TaskRunner looks
> better
> > to
> > > > me to expose. WDYT?
> > > 
> > > Can you tell me why having Client::getTaskRunner is better than passing a
> task
> > > runner to obtainReader? I guess Client::getTaskRunner needs to be called
> from
> > > the client's thread, and that means most if not all implementations who
> needs
> > > the task runner calls it in their obtainReader implementation.
> > > Client::getTaskRunner looks overly general to me.
> > 
> > My point is just that I want to avoid passing low-level things like task
> runners
> > in many Blink classes. Also the lifetime management of the task runner is a
> bit
> > tricky because we need to clone it.
> > 
> > BTW, on what thread does the obtainReader run? I was thinking that it runs
on
> > the main thread, so Client::getTaskRunner() would make sense.
> > 
> > - If it runs on only the main thread, Client::getTaskRunner(),
Client::frame()
> > or passing frame would work.
> > 
> > - If it runs on a non-main thread, I think it's better to make the thread
> > understand the task runner when the thread is constructed (c.f.,
kinuko-san's
> > CL: https://codereview.chromium.org/2163983004/) instead of passing the task
> > runner every time obtainReader is requested.
> 
> It's used on the main thread and worker threads.
> WebDataConsumerHandle can be used in a separate thread from which it is
created,
> and that makes implementations harder to read, harder to modify. Again, I am
> fixing it by replacing them with a thread-bound interface.

Yeah, this looks like a good way to go. Then the thread-bound interface can use
a thread-bound helper class that returns the task runners of that thread (<-- we
need to implement the helper class by extending kinuko-san's CL).

Powered by Google App Engine
This is Rietveld 408576698