Bug 45891 - DeviceOrientationClient and DeviceMotionClient should have controllerDestroyed() methods
Summary: DeviceOrientationClient and DeviceMotionClient should have controllerDestroye...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 30335
  Show dependency treegraph
 
Reported: 2010-09-16 07:50 PDT by Steve Block
Modified: 2010-09-21 07:03 PDT (History)
8 users (show)

See Also:


Attachments
Patch (9.21 KB, patch)
2010-09-16 09:41 PDT, Steve Block
no flags Details | Formatted Diff | Diff
Patch (9.49 KB, patch)
2010-09-20 10:22 PDT, Steve Block
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Block 2010-09-16 07:50:10 PDT
This is the pattern used for other controller/client pairs and will allow the client to be destroyed by the embedder when the Page and hence controller is destroyed.
Comment 1 Steve Block 2010-09-16 09:41:18 PDT
Created attachment 67806 [details]
Patch
Comment 2 Hans Wennborg 2010-09-17 02:31:29 PDT
This looks fine. 

My only concern was the empty clients, and whether they might be leaked by some implementations because they implement controllerDestroyed() as a nop. But the way they're used in SVGImage, it doesn't seem to be a real concern.
Comment 3 Steve Block 2010-09-17 03:02:17 PDT
> My only concern was the empty clients, and whether they might be leaked by some
> implementations because they implement controllerDestroyed() as a nop. But the
> way they're used in SVGImage, it doesn't seem to be a real concern.
Yes, I considered this too, but all of the other empty clients implement it as a no-op, so I followed the pattern.
Comment 4 Jeremy Orlow 2010-09-17 05:12:26 PDT
Someone should review this from the mac port side.  Darin, any thoughts about the naming of the methods?
Comment 5 Steve Block 2010-09-20 02:34:18 PDT
> Someone should review this from the mac port side.
Added Chris and Simon who looked at the original patch to add the Mac client.

> Darin, any thoughts about the naming of the methods?
The naming for existing clients doesn't seem to follow a precise pattern. Usually, with a FooController and a FooClient, the method is fooControllerDestroyed(), but there are exceptions, such as {Chrome, ChromeClient, chromeDestroyed()} and {GeolocationController, GeolocationControllerClient and geolocationDestroyed()}.

deviceOrientationControllerDestroyed() seemed needlessly wordy, as it's pretty obvious which controller has been destroyed, so I went with controllerDestroyed().
Comment 6 Darin Fisher (:fishd, Google) 2010-09-20 09:33:29 PDT
(In reply to comment #5)
> > Someone should review this from the mac port side.
> Added Chris and Simon who looked at the original patch to add the Mac client.
> 
> > Darin, any thoughts about the naming of the methods?
> The naming for existing clients doesn't seem to follow a precise pattern. Usually, with a FooController and a FooClient, the method is fooControllerDestroyed(), but there are exceptions, such as {Chrome, ChromeClient, chromeDestroyed()} and {GeolocationController, GeolocationControllerClient and geolocationDestroyed()}.
> 
> deviceOrientationControllerDestroyed() seemed needlessly wordy, as it's pretty obvious which controller has been destroyed, so I went with controllerDestroyed().

You could run into a problem if you ever want to have a class that implements multiple Client interfaces.  Suppose two Client interfaces both declare controllerDestroyed() methods.
Comment 7 Steve Block 2010-09-20 10:22:01 PDT
Created attachment 68107 [details]
Patch
Comment 8 Jeremy Orlow 2010-09-21 05:41:21 PDT
Comment on attachment 68107 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=68107&action=review

> WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm:65
> +      delete this;

I'm not positive about this part.  If you are, then I guess we can go with it.  If you aren't, maybe this should go in its own patch for someone from the mac port to review?
Comment 9 Steve Block 2010-09-21 06:40:28 PDT
Comment on attachment 68107 [details]
Patch

I'm pretty confident this is correct. Will happily roll back or update if the Mac guys have any comments.
Comment 10 WebKit Commit Bot 2010-09-21 07:03:45 PDT
Comment on attachment 68107 [details]
Patch

Clearing flags on attachment: 68107

Committed r67949: <http://trac.webkit.org/changeset/67949>
Comment 11 WebKit Commit Bot 2010-09-21 07:03:52 PDT
All reviewed patches have been landed.  Closing bug.