RESOLVED FIXED 90944
Remove setController from BatteryClient
https://bugs.webkit.org/show_bug.cgi?id=90944
Summary Remove setController from BatteryClient
Kihong Kwon
Reported 2012-07-10 23:33:45 PDT
BatteryClient doesn't need to keep m_controller becuase, we can use BatteryController by BatteryController::from(). Therefore we can remove setController from BatteryClient.
Attachments
Patch (19.92 KB, patch)
2012-07-11 04:03 PDT, Kihong Kwon
no flags
Patch (19.74 KB, patch)
2012-07-12 23:39 PDT, Kihong Kwon
no flags
Patch. (15.11 KB, patch)
2012-07-13 00:49 PDT, Kihong Kwon
no flags
Archive of layout-test-results from gce-cr-linux-07 (544.06 KB, application/zip)
2012-07-13 02:59 PDT, WebKit Review Bot
no flags
Patch (17.22 KB, patch)
2012-07-13 20:47 PDT, Kihong Kwon
no flags
Kihong Kwon
Comment 1 2012-07-11 04:03:03 PDT
Chris Dumez
Comment 2 2012-07-11 04:19:45 PDT
Comment on attachment 151671 [details] Patch LGTM.
Gyuyoung Kim
Comment 3 2012-07-11 18:33:26 PDT
Comment on attachment 151671 [details] Patch Because BatteryController is already supplementable, we don't need to use a member variable for controller. Looks fine.
Adam Barth
Comment 4 2012-07-12 09:37:42 PDT
Comment on attachment 151671 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=151671&action=review > Source/WebKit/blackberry/Api/WebPage.cpp:522 > - WebCore::provideBatteryTo(m_page, new WebCore::BatteryClientBlackBerry); > + WebCore::provideBatteryTo(m_page, new WebCore::BatteryClientBlackBerry(this)); Where is the BatteryClientBlackBerry deleted? I see. There's the delete this pattern in batteryControllerDestroyed. That's a bad design. > Source/WebKit/chromium/src/BatteryClientImpl.cpp:45 > +BatteryClientImpl::BatteryClientImpl(WebViewImpl* webView) > + : m_webView(webView) This isn't the usual pattern for subclasses of WebCore clients. Typically the WebCore clients are wired directly to the WebKit API clients. > Source/WebKit/chromium/src/BatteryClientImpl.cpp:69 > void BatteryClientImpl::batteryControllerDestroyed() > { > - m_controller = 0; > } It seems unlikely that this function should both exist and do nothing. > Source/WebKit/chromium/src/WebViewImpl.h:819 > - OwnPtr<BatteryClientImpl> m_batteryClient; > + BatteryClientImpl m_batteryClientImpl; This isn't the usual pattern for subclasses of WebCore clients. It's more likely that we should follow the usual conventions instead of having the battery client be weird.
Kihong Kwon
Comment 5 2012-07-12 23:15:44 PDT
Comment on attachment 151671 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=151671&action=review Basically I think we don't need to keep the controller which inherits Supplement. As you know, we can access controller by Supplement::from. But I wondering how you think about this? Thank you for reviewing. :) >> Source/WebKit/blackberry/Api/WebPage.cpp:522 >> + WebCore::provideBatteryTo(m_page, new WebCore::BatteryClientBlackBerry(this)); > > Where is the BatteryClientBlackBerry deleted? I see. There's the delete this pattern in batteryControllerDestroyed. That's a bad design. Usually blackberry port use client like this. For instance, WebCore::provideDeviceOrientationTo(m_page, new DeviceOrientationClientBlackBerry(this)); WebCore::provideDeviceMotionTo(m_page, new DeviceMotionClientBlackBerry(this)); If we change this design, we need to raise an issue about this to blackberry guys. >> Source/WebKit/chromium/src/BatteryClientImpl.cpp:45 >> + : m_webView(webView) > > This isn't the usual pattern for subclasses of WebCore clients. Typically the WebCore clients are wired directly to the WebKit API clients. In this case(using supplement::from instead of m_controller) we need to access page instance. But, actually there is no way to access page instance of WebView in the client. And this way is not much different from DragClientImpl or EditorClientImpl. If I'm wrong, please let me know. >> Source/WebKit/chromium/src/BatteryClientImpl.cpp:69 >> } > > It seems unlikely that this function should both exist and do nothing. In this way, we don't need to use this function in the chromium port, but other ports still need this. >> Source/WebKit/chromium/src/WebViewImpl.h:819 >> + BatteryClientImpl m_batteryClientImpl; > > This isn't the usual pattern for subclasses of WebCore clients. It's more likely that we should follow the usual conventions instead of having the battery client be weird. OK. I will fix it.
Kihong Kwon
Comment 6 2012-07-12 23:39:35 PDT
Kihong Kwon
Comment 7 2012-07-13 00:49:39 PDT
Created attachment 152175 [details] Patch. I used geolocation implementation by reference for chromium port.
WebKit Review Bot
Comment 8 2012-07-13 02:59:40 PDT
Comment on attachment 152175 [details] Patch. Attachment 152175 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13221571 New failing tests: http/tests/w3c/webperf/approved/navigation-timing/html/test_performance_attributes_exist_in_object.html
WebKit Review Bot
Comment 9 2012-07-13 02:59:44 PDT
Created attachment 152200 [details] Archive of layout-test-results from gce-cr-linux-07 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-07 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Adam Barth
Comment 10 2012-07-13 10:15:56 PDT
> http/tests/w3c/webperf/approved/navigation-timing/html/test_performance_attributes_exist_in_object.html Sorry for the spam. I've marked this test as flaky.
Kihong Kwon
Comment 11 2012-07-13 20:47:28 PDT
Adam Barth
Comment 12 2012-07-16 10:29:57 PDT
Comment on attachment 152404 [details] Patch Ok. It's a bit odd that this works differently for different ports, but I don't see a problem with it.
WebKit Review Bot
Comment 13 2012-07-16 11:28:43 PDT
Comment on attachment 152404 [details] Patch Clearing flags on attachment: 152404 Committed r122743: <http://trac.webkit.org/changeset/122743>
WebKit Review Bot
Comment 14 2012-07-16 11:28:49 PDT
All reviewed patches have been landed. Closing bug.
Kihong Kwon
Comment 15 2012-07-16 18:11:34 PDT
(In reply to comment #12) > (From update of attachment 152404 [details]) > Ok. It's a bit odd that this works differently for different ports, but I don't see a problem with it. Thank you for your review, adam. :-)
Note You need to log in before you can comment on or make changes to this bug.