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

Issue 1810513002: Media element resource selection algorithm should "await a stable state"

Created:
4 years, 9 months ago by Srirama
Modified:
4 years, 2 months ago
CC:
blink-reviews, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink, eric.carlson_apple.com, feature-media-reviews_chromium.org, gasubic, mlamouri+watch-blink_chromium.org, nessy, vcarbune.chromium
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Media element resource selection algorithm should "await a stable state" Right now in HTMLMediaElement we post a plain task for "await a stable state" step in resource selection algorithm. But as per the spec we should post a microtask. Implemented microtask for the same. BUG=593289

Patch Set 1 #

Total comments: 9

Patch Set 2 : changed loadtimer to texttrackloadtimer #

Total comments: 21

Patch Set 3 : Use CancellableTaskFactory #

Total comments: 7

Patch Set 4 : Rebase and address review comments #

Total comments: 2

Patch Set 5 : Rebase and comment fix #

Patch Set 6 : Rebase and microtask changes #

Total comments: 1

Patch Set 7 : Rebase, microtask changes, layouttest updation #

Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -51 lines) Patch
M third_party/WebKit/LayoutTests/media/video-delay-load-event.html View 1 2 3 4 5 6 2 chunks +5 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/media/video-source.html View 1 2 3 4 5 6 1 chunk +3 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMediaElement.h View 1 2 3 4 5 6 6 chunks +6 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMediaElement.cpp View 1 2 3 4 5 6 13 chunks +26 lines, -39 lines 0 comments Download

Messages

Total messages: 91 (19 generated)
Srirama
PTAL. If these changes are ok, then i will update the test expectations for web-platform-tests.
4 years, 9 months ago (2016-03-16 12:08:49 UTC) #4
philipj_slow
https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode896 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:896: Microtask::enqueueMicrotask(task.release()); If you have a look at RTCPeerConnection.cpp and ...
4 years, 9 months ago (2016-03-16 13:40:20 UTC) #5
Srirama
https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode900 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:900: void HTMLMediaElement::continueResourceSelectionAlgorithm() On 2016/03/16 13:40:20, philipj_UTC7 wrote: > All ...
4 years, 9 months ago (2016-03-16 14:25:40 UTC) #6
Srirama
https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode900 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:900: void HTMLMediaElement::continueResourceSelectionAlgorithm() On 2016/03/16 14:25:40, Srirama wrote: > On ...
4 years, 9 months ago (2016-03-16 14:35:23 UTC) #7
philipj_slow
https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode896 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:896: Microtask::enqueueMicrotask(task.release()); On 2016/03/16 13:40:20, philipj_UTC7 wrote: > If you ...
4 years, 9 months ago (2016-03-16 15:35:10 UTC) #8
Srirama
https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode896 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:896: Microtask::enqueueMicrotask(task.release()); Infact when i started i just copied it ...
4 years, 9 months ago (2016-03-16 17:41:17 UTC) #9
Srirama
I have removed scheduleTextTrackResurceLoad and directly called honorUser..... function. All the tests are passing except ...
4 years, 9 months ago (2016-03-17 07:53:08 UTC) #10
fs
On 2016/03/17 at 07:53:08, srirama.m wrote: > I have removed scheduleTextTrackResurceLoad and directly called honorUser..... ...
4 years, 9 months ago (2016-03-17 09:49:35 UTC) #11
philipj_slow
On 2016/03/17 09:49:35, fs (traveling) wrote: > On 2016/03/17 at 07:53:08, srirama.m wrote: > > ...
4 years, 9 months ago (2016-03-17 11:11:12 UTC) #12
philipj_slow
sof@, alexclarke@, you're the top pokers of CancellableTaskFactoryTest.cpp, so I hope you can advise on ...
4 years, 9 months ago (2016-03-17 11:30:55 UTC) #14
alex clarke (OOO till 29th)
+skyostil@ On 2016/03/17 11:30:55, philipj_UTC7 wrote: > sof@, alexclarke@, you're the top pokers of CancellableTaskFactoryTest.cpp, ...
4 years, 9 months ago (2016-03-17 12:05:08 UTC) #16
Sami
> 4. We could add a new API that lets blink create a WebTaskRunner for ...
4 years, 9 months ago (2016-03-17 12:43:55 UTC) #17
Srirama
@philip, so i assume this CL can go ahead as per your comment #12. So ...
4 years, 9 months ago (2016-03-18 07:38:11 UTC) #18
philipj_slow
On 2016/03/17 12:05:08, alexclarke1 wrote: > +skyostil@ > > On 2016/03/17 11:30:55, philipj_UTC7 wrote: > ...
4 years, 9 months ago (2016-03-23 06:48:57 UTC) #19
philipj_slow
On 2016/03/17 12:43:55, Sami wrote: > > 4. We could add a new API that ...
4 years, 9 months ago (2016-03-23 06:52:40 UTC) #20
philipj_slow
https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode879 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:879: if (m_textTrackLoadTimer.isActive()) { On 2016/03/18 07:38:11, Srirama wrote: > ...
4 years, 9 months ago (2016-03-23 07:12:02 UTC) #21
philipj_slow
On 2016/03/18 07:38:11, Srirama wrote: > @philip, so i assume this CL can go ahead ...
4 years, 9 months ago (2016-03-23 07:13:12 UTC) #22
philipj_slow
https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode272 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:272: class HTMLMediaElement::Task : public WebTaskRunner::Task { It looks like ...
4 years, 9 months ago (2016-03-23 07:27:18 UTC) #23
Sami
On 2016/03/23 06:48:57, philipj_UTC7 wrote: > > 4. We could add a new API that ...
4 years, 9 months ago (2016-03-23 11:00:00 UTC) #24
Sami
(Filed https://bugs.chromium.org/p/chromium/issues/detail?id=597240 for the new task runner interface.)
4 years, 9 months ago (2016-03-23 11:06:59 UTC) #25
philipj_slow
https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode298 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:298: ScriptState::Scope scope(m_scriptState.get()); What break if there is no ScriptState::Scope ...
4 years, 9 months ago (2016-03-24 04:43:05 UTC) #26
Srirama
https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode272 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:272: class HTMLMediaElement::Task : public WebTaskRunner::Task { On 2016/03/23 07:27:18, ...
4 years, 8 months ago (2016-03-29 11:26:29 UTC) #27
philipj_slow
https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode272 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:272: class HTMLMediaElement::Task : public WebTaskRunner::Task { On 2016/03/29 11:26:29, ...
4 years, 8 months ago (2016-03-29 12:39:33 UTC) #28
Srirama
https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode1431 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:1431: enqueueMicrotask(); On 2016/03/29 12:39:32, philipj_UTC7 wrote: > On 2016/03/29 ...
4 years, 8 months ago (2016-03-29 12:49:12 UTC) #29
philipj_slow
https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode1431 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:1431: enqueueMicrotask(); On 2016/03/29 12:49:12, Srirama wrote: > On 2016/03/29 ...
4 years, 8 months ago (2016-03-29 12:57:51 UTC) #30
Srirama
PTAL. https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode272 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:272: class HTMLMediaElement::Task : public WebTaskRunner::Task { On 2016/03/29 ...
4 years, 8 months ago (2016-03-30 11:35:40 UTC) #32
Srirama
On 2016/03/30 11:35:40, Srirama wrote: > PTAL. > > https://codereview.chromium.org/1810513002/diff/20001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp > File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): > ...
4 years, 8 months ago (2016-04-05 09:38:06 UTC) #33
philipj_slow
I love the way this is going, more and more like the spec :) I ...
4 years, 8 months ago (2016-04-06 12:06:52 UTC) #34
Srirama
I have intentionally not added abort step, as it is already being cancelled as part ...
4 years, 8 months ago (2016-04-11 08:08:00 UTC) #36
Srirama
On 2016/04/11 08:08:00, Srirama wrote: > I have intentionally not added abort step, as it ...
4 years, 8 months ago (2016-04-18 12:27:51 UTC) #37
philipj_slow
My nick says I'm slow, and it's true! I think this looks good now, can ...
4 years, 8 months ago (2016-04-19 14:52:45 UTC) #38
Srirama
On 2016/04/19 14:52:45, philipj_slow wrote: > My nick says I'm slow, and it's true! I ...
4 years, 8 months ago (2016-04-22 15:24:22 UTC) #40
philipj_slow
Thanks Srirama, from that and looking at the resource selection algorithm in the spec I'm ...
4 years, 7 months ago (2016-04-27 13:28:09 UTC) #41
fs
4 years, 7 months ago (2016-04-27 13:45:18 UTC) #43
Srirama
On 2016/04/27 13:28:09, philipj_slow wrote: > Thanks Srirama, from that and looking at the resource ...
4 years, 7 months ago (2016-04-28 13:17:45 UTC) #44
philipj_slow
On 2016/04/28 13:17:45, Srirama wrote: > On 2016/04/27 13:28:09, philipj_slow wrote: > > Thanks Srirama, ...
4 years, 7 months ago (2016-04-28 13:27:44 UTC) #45
Srirama
On 2016/04/28 13:27:44, philipj_slow wrote: > On 2016/04/28 13:17:45, Srirama wrote: > > On 2016/04/27 ...
4 years, 7 months ago (2016-04-28 14:02:56 UTC) #46
philipj_slow
On 2016/04/28 14:02:56, Srirama wrote: > On 2016/04/28 13:27:44, philipj_slow wrote: > > On 2016/04/28 ...
4 years, 7 months ago (2016-04-29 08:23:59 UTC) #47
Srirama
On 2016/04/29 08:23:59, philipj_slow wrote: > On 2016/04/28 14:02:56, Srirama wrote: > > On 2016/04/28 ...
4 years, 7 months ago (2016-04-29 09:44:33 UTC) #48
philipj_slow
On 2016/04/29 09:44:33, Srirama wrote: > On 2016/04/29 08:23:59, philipj_slow wrote: > > On 2016/04/28 ...
4 years, 7 months ago (2016-04-29 09:55:38 UTC) #49
Srirama
@Nate, could you please give your inputs or suggestions here from blink loader perspective. Right ...
4 years, 7 months ago (2016-05-02 07:29:55 UTC) #51
Srirama
+Mike West. @Mike, can you please give your inputs here? Refer to the comment #51 ...
4 years, 7 months ago (2016-05-10 06:49:28 UTC) #53
Srirama
On 2016/05/10 06:49:28, Srirama wrote: > +Mike West. > @Mike, can you please give your ...
4 years, 7 months ago (2016-05-16 10:26:44 UTC) #54
fs
On 2016/05/16 at 10:26:44, srirama.m wrote: > On 2016/05/10 06:49:28, Srirama wrote: > > +Mike ...
4 years, 7 months ago (2016-05-16 10:58:25 UTC) #55
Srirama
On 2016/05/16 10:58:25, fs wrote: > On 2016/05/16 at 10:26:44, srirama.m wrote: > > On ...
4 years, 7 months ago (2016-05-16 11:38:32 UTC) #56
fs
On 2016/05/16 at 11:38:32, srirama.m wrote: > On 2016/05/16 10:58:25, fs wrote: > > On ...
4 years, 7 months ago (2016-05-16 12:10:49 UTC) #57
Srirama
On 2016/05/16 12:10:49, fs wrote: > On 2016/05/16 at 11:38:32, srirama.m wrote: > > On ...
4 years, 7 months ago (2016-05-16 12:18:07 UTC) #58
Srirama
@foolip, @fs, PTAL. To give you the context on why it was stalled, some of ...
4 years, 3 months ago (2016-08-31 14:58:52 UTC) #63
fs
On 2016/08/31 at 14:58:52, srirama.m wrote: > @foolip, @fs, PTAL. > > To give you ...
4 years, 3 months ago (2016-08-31 15:17:24 UTC) #64
foolip
On 2016/08/31 15:17:24, fs wrote: > On 2016/08/31 at 14:58:52, srirama.m wrote: > > @foolip, ...
4 years, 3 months ago (2016-09-01 12:36:29 UTC) #67
Sami
On 2016/09/01 12:36:29, foolip wrote: > On 2016/08/31 15:17:24, fs wrote: > > On 2016/08/31 ...
4 years, 3 months ago (2016-09-01 12:42:56 UTC) #68
fs
On 2016/09/01 at 12:42:56, skyostil wrote: > On 2016/09/01 12:36:29, foolip wrote: > > On ...
4 years, 3 months ago (2016-09-01 13:08:48 UTC) #69
Srirama
On 2016/09/01 13:08:48, fs wrote: > On 2016/09/01 at 12:42:56, skyostil wrote: > > On ...
4 years, 3 months ago (2016-09-02 07:47:56 UTC) #70
fs
On 2016/09/02 at 07:47:56, srirama.m wrote: > On 2016/09/01 13:08:48, fs wrote: > > On ...
4 years, 3 months ago (2016-09-02 08:08:51 UTC) #71
foolip
On 2016/09/02 08:08:51, fs wrote: > On 2016/09/02 at 07:47:56, srirama.m wrote: > > On ...
4 years, 3 months ago (2016-09-02 08:55:47 UTC) #72
Sami
(+haraken@ FYI) > > Probably a TODO for now to revisit it once the mappings ...
4 years, 3 months ago (2016-09-02 09:55:46 UTC) #74
haraken
On 2016/09/02 09:55:46, Sami wrote: > (+haraken@ FYI) > > > > Probably a TODO ...
4 years, 3 months ago (2016-09-02 10:01:32 UTC) #75
fs
On 2016/09/02 at 09:55:46, skyostil wrote: > (+haraken@ FYI) > > > > Probably a ...
4 years, 3 months ago (2016-09-02 10:24:11 UTC) #76
foolip
https://codereview.chromium.org/1810513002/diff/180001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/1810513002/diff/180001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode855 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:855: Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, m_resourceSelectionAlgorithmContinuationTask->cancelAndCreate()); Just to be clear, this and the ...
4 years, 3 months ago (2016-09-02 10:31:00 UTC) #77
Srirama
On 2016/09/02 10:31:00, foolip wrote: > https://codereview.chromium.org/1810513002/diff/180001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp > File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): > > https://codereview.chromium.org/1810513002/diff/180001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode855 > ...
4 years, 3 months ago (2016-09-02 12:55:07 UTC) #78
foolip
On 2016/09/02 12:55:07, Srirama wrote: > On 2016/09/02 10:31:00, foolip wrote: > > > https://codereview.chromium.org/1810513002/diff/180001/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ...
4 years, 3 months ago (2016-09-02 14:12:11 UTC) #79
Sami
On 2016/09/02 14:12:11, foolip wrote: > Yeah, that is the tricky bit. If there really ...
4 years, 3 months ago (2016-09-02 14:19:13 UTC) #80
Srirama
On 2016/09/02 14:19:13, Sami wrote: > On 2016/09/02 14:12:11, foolip wrote: > > Yeah, that ...
4 years, 3 months ago (2016-09-06 11:43:30 UTC) #81
Sami
On 2016/09/06 11:43:30, Srirama wrote: > So can i do something similar to ImageLoader::Task in ...
4 years, 3 months ago (2016-09-06 12:12:14 UTC) #82
Srirama
On 2016/09/06 12:12:14, Sami wrote: > On 2016/09/06 11:43:30, Srirama wrote: > > So can ...
4 years, 3 months ago (2016-09-14 13:04:08 UTC) #83
fs
On 2016/09/14 at 13:04:08, srirama.m wrote: > On 2016/09/06 12:12:14, Sami wrote: > > On ...
4 years, 3 months ago (2016-09-14 13:24:32 UTC) #84
Srirama
On 2016/09/14 13:24:32, fs wrote: > On 2016/09/14 at 13:04:08, srirama.m wrote: > > On ...
4 years, 3 months ago (2016-09-14 13:46:02 UTC) #85
Sami
> > Probably best if Sami expands on what he had in mind, but I ...
4 years, 3 months ago (2016-09-14 13:58:41 UTC) #86
Srirama
PTAL. 1. Updated two test cases to match the new behavior. 2. Still the old ...
4 years, 3 months ago (2016-09-17 13:34:27 UTC) #88
foolip
On 2016/09/17 13:34:27, Srirama wrote: > PTAL. > 1. Updated two test cases to match ...
4 years, 2 months ago (2016-09-22 09:51:59 UTC) #89
alex clarke (OOO till 29th)
On 2016/03/17 12:05:08, alex clarke wrote: > +skyostil@ > > On 2016/03/17 11:30:55, philipj_UTC7 wrote: ...
4 years, 2 months ago (2016-09-22 10:18:16 UTC) #90
Srirama
4 years, 2 months ago (2016-09-22 10:25:36 UTC) #91
On 2016/09/22 10:18:16, alex clarke wrote:
> On 2016/03/17 12:05:08, alex clarke wrote:
> > +skyostil@
> > 
> > On 2016/03/17 11:30:55, philipj_UTC7 wrote:
> > > sof@, alexclarke@, you're the top pokers of
CancellableTaskFactoryTest.cpp,
> so
> > I
> > > hope you can advise on this situation.
> > > 
> > > In the HTML spec, media elements have their own task source, which is used
> for
> > > queueing tasks for fire events and many other things. At any point, all
> > pending
> > > tasks can be canceled, this happens when starting a new resource loads so
> that
> > > tasks/events from a previous resource are not misattributed (by event
> > handlers)
> > > as being about the new source.
> > > 
> > > The spec also says "await a stable state" in a few algorithms that can can
> be
> > > aborted with language like "Abort any already-running instance of the
> resource
> > > selection algorithm for this element." This amounts to cancelable
> microtasks.
> > > 
> > > What do you make of this situation? I see a few options:
> > > 
> > > 1. A media element-specific type of callback object, that can be used for
> both
> > > tasks and microtasks, where HTMLMediaElement keeps track of all pending
> tasks
> > > and has a state bit for each to neuter them, so that their callback
becomes
> a
> > > no-op.
> > > 
> > > 2. Adapting CancellableTaskFactory to be able to create any number of
> pending
> > > tasks that can all be canceled as a group. AFAICT the shared type for
> > microtasks
> > > and tasks is SameThreadClosure, but CancellableTaskFactory makes
> > > WebTaskRunner::Task. Not sure if this is trivial or hard to bridge.
> > The CancellableTaskFactory actually builds a SameThreadClosure, so getting
it
> to
> > instead accept one should be easy.
> > 
> > Mass cancellation is possibly a little trickier.  Would individual
> cancellation
> > still be needed?  If not then a group could all share the same weak pointer.

> > We'd probably need a new class based on CancellableTaskFactory.
> 
> Not sure if this is still relevant, but FWIW the scheduler now has a fast path
> for detecting cancelled tasks 
> (via weak pointers).
> 
> dchang@ has been advocating a pattern like so:
> 
> WeakPtrFactory<SomeClass> m_factory;
> 
> web_task_runner->postTask(BLINK_FROM_HERE, WTF::bind(&SomeClass::func1,
> m_factory.createWeakPtr()));
> web_task_runner->postTask(BLINK_FROM_HERE, WTF::bind(&SomeClass::func2,
> m_factory.createWeakPtr()));
> web_task_runner->postTask(BLINK_FROM_HERE, WTF::bind(&SomeClass::func3,
> m_factory.createWeakPtr()));
> web_task_runner->postTask(BLINK_FROM_HERE, WTF::bind(&SomeClass::func4,
> m_factory.createWeakPtr()));
> 
> ...
> 
> m_factory.revokeAll(); // Cancels all pending tasks.
> 

Thanks Alex, my latest patcheset already has the changes based on this pattern,
though we are using Microtask instead of webtaskrunner.

> > 
> > > 
> > > 3. Fiddle with task and microtask queues to make it possible to actually
> > remove
> > > tasks from them. Presumably this is very hard/messy, but it's worth
asking.
> > This is really tricky under the hood since both the chromium base message
loop
> > and the render scheduler have been built with the assumption that
cancellation
> > is the responsibility of the task itself.  Data structures like std::queue
and
> > std::priority_queue have been used that don't support arbitrary deletion.
> > 
> > > 
> > > WDYT?
> > 
> > I can think of a few other ways this could be done:
> > 
> > 4. We could add a new API that lets blink create a WebTaskRunner for media
> > elements, along with something to allow mass-cancellation of all tasks
posted
> on
> > it.  This has some nice side effects for frame blamer and tracing.
> > 
> > 5. I'm not sure if it's applicable here, but I have a C++ promises demo that
> has
> > a dependency graph of tasks (i.e. Task D runs after A, B & C and if you
cancel
> > task D then A, B & C no longer need to run).
> > https://codereview.chromium.org/1401553002/
> > 
> > 
> > > 
> > >
> >
>
https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/c...
> > > File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right):
> > > 
> > >
> >
>
https://codereview.chromium.org/1810513002/diff/1/third_party/WebKit/Source/c...
> > > third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:896:
> > > Microtask::enqueueMicrotask(task.release());
> > > On 2016/03/16 17:41:17, Srirama wrote:
> > > > Infact when i started i just copied it from ImageLoader but i realized
> that
> > we
> > > > need it for aborting the already running instance. This is the only
> reason.
> > > 
> > > OK. So this problem has come up several times recently. To make
> > HTMLMediaElement
> > > more per spec, we really need both tasks and microtasks that can be
> canceled.
> > > Events should also also be fired using such tasks, replacing the
> > > m_asyncEventQueue.
> > > 
> > > Right now the best candidate for all of this is CancellableTaskFactory,
but
> > IIRC
> > > it can only have one task in flight at a time, because that's just what
> > > cancelAndCreate does. I'll add a few reviewers and ask for advice.

Powered by Google App Engine
This is Rietveld 408576698