Bug 69181

Summary: [chromium] Add WebWidget API for accessing the current WebCompositor
Product: WebKit Reporter: James Robinson <jamesr>
Component: New BugsAssignee: James Robinson <jamesr>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 69251    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
fix silly bug in compositorForIdentifier()...maybe i need tests
none
add basic test for compositorForIdentifier
none
Patch for landing none

James Robinson
Reported 2011-09-30 16:06:32 PDT
[chromium] Add WebWidget API for accessing the current WebCompositor
Attachments
Patch (4.70 KB, patch)
2011-09-30 16:08 PDT, James Robinson
no flags
Patch (11.37 KB, patch)
2011-09-30 17:35 PDT, James Robinson
no flags
fix silly bug in compositorForIdentifier()...maybe i need tests (11.38 KB, patch)
2011-09-30 17:44 PDT, James Robinson
no flags
add basic test for compositorForIdentifier (15.57 KB, patch)
2011-09-30 18:27 PDT, James Robinson
no flags
Patch for landing (14.17 KB, patch)
2011-10-02 17:05 PDT, James Robinson
no flags
James Robinson
Comment 1 2011-09-30 16:08:07 PDT
Darin Fisher (:fishd, Google)
Comment 2 2011-09-30 16:12:52 PDT
Comment on attachment 109364 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=109364&action=review > Source/WebKit/chromium/public/WebWidget.h:176 > + // The WebCompositor may only be accessed and is destroyed from the compositor thread. nit: This almost sounds like it is saying that you need to call this WebWidget::compositor() method on the compositor thread. Instead, maybe tweak the text slightly like so: // The WebCompositor's methods may only be called on the compositor thread. I'm concerned there may still be a race-condition at setup time. Could the WebCompositor get destroyed, on the compositor thread, before the consumer has a chance to set the WebCompositorClient pointer on the WebCompositor? Hmm...
James Robinson
Comment 3 2011-09-30 16:19:05 PDT
(In reply to comment #2) > (From update of attachment 109364 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=109364&action=review > > > Source/WebKit/chromium/public/WebWidget.h:176 > > + // The WebCompositor may only be accessed and is destroyed from the compositor thread. > > nit: This almost sounds like it is saying that you need to call this WebWidget::compositor() > method on the compositor thread. Instead, maybe tweak the text slightly like so: > > // The WebCompositor's methods may only be called on the compositor thread. > sure, will do > I'm concerned there may still be a race-condition at setup time. Could the WebCompositor > get destroyed, on the compositor thread, before the consumer has a chance to set the > WebCompositorClient pointer on the WebCompositor? > > Hmm... The way things work today, the compositor can only be destroyed from a main-thread initiated action. It can't get destroyed before (say) WebWidgetClient::didActivateAcceleratedCompositing() returns, but it could get destroyed as soon as the main thread's message loop is destroyed. When the compositor is shut down, it posts a task to the compositor thread and spins the message loop until it hits the quit task. So it seems like the contract here is that in order to not be racy, the WebWidgetClient implementation has to post a task on the compositor thread to register its WebCompositorClient before it returns from WebWidgetClient::didActivateAcceleratedCompositing(). that's what I have coded up locally in render_widget.cc - i'm calling CompositorThread::AddCompositor() which posts a task.
James Robinson
Comment 4 2011-09-30 17:35:31 PDT
James Robinson
Comment 5 2011-09-30 17:36:28 PDT
Adds the weak binding mechanism we talked about. The intended use is that the WebWidgetClient implementation gets a didEnableAcceleratedCompositing() call with an ID, posts a task to the compositor thread with that ID, and then on the compositor thread looks up a WebCompositor* and registers its WebCompositorClient on that thread so it can get the willShutdown() call.
James Robinson
Comment 6 2011-09-30 17:44:21 PDT
Created attachment 109385 [details] fix silly bug in compositorForIdentifier()...maybe i need tests
James Robinson
Comment 7 2011-09-30 18:27:54 PDT
Created attachment 109389 [details] add basic test for compositorForIdentifier
Darin Fisher (:fishd, Google)
Comment 8 2011-09-30 21:29:54 PDT
Comment on attachment 109389 [details] add basic test for compositorForIdentifier View in context: https://bugs.webkit.org/attachment.cgi?id=109389&action=review R=me w/ these suggested changes. > Source/WebKit/chromium/public/WebCompositor.h:43 > + WEBKIT_EXPORT static WebCompositor* compositorForIdentifier(int); nit: at callsites, this will look like WebCompositor::compositorForIdentifier(x), but since that says "compositor" twice, how about WebCompositor::fromIdentifier(x) instead? kinda like String::fromUTF8, etc. > Source/WebKit/chromium/public/WebWidget.h:44 > +class WebCompositor; nit: can delete this now > Source/WebKit/chromium/public/WebWidgetClient.h:61 > + virtual void didEnableAcceleratedCompositing(int compositorIdentifier) { } nit: I originally wanted to use the word "enable" here, but vangelis talked me out of it, since we already use the term "enable" in the WebSettings API: WebSettings::setAcceleratedCompositingEnabled(bool). That's why we settled on "activate", and then this term is used pretty consistently on the Chrome side too IIRC. it is OK to temporarily override a method name. didActivateAcceleratedCompositing(int compositorIdentifier) { } didDeactivateAcceleratedCompositing() { } Hmm, actually... I wonder why we need to say "accelerated" in these method names. Everywhere else we pretty much leave off that prefix. Could just go with this: didActivateCompositor(int compositorIdentifier) { } didDeactivateCompositor() { } > Source/WebKit/chromium/src/WebCompositorImpl.cpp:73 > + nit: extra new line
James Robinson
Comment 9 2011-10-02 17:05:48 PDT
Created attachment 109432 [details] Patch for landing
WebKit Review Bot
Comment 10 2011-10-02 18:10:52 PDT
Comment on attachment 109432 [details] Patch for landing Clearing flags on attachment: 109432 Committed r96481: <http://trac.webkit.org/changeset/96481>
WebKit Review Bot
Comment 11 2011-10-02 18:10:56 PDT
All reviewed patches have been landed. Closing bug.
James Robinson
Comment 12 2011-10-03 12:51:17 PDT
Note You need to log in before you can comment on or make changes to this bug.