Small refinements: - Return PassRef instead of PassRefPtr in create method - Switched to nullptr instead of 0 where appropriate. - Removed unused function and header file. - Removed unnecessary empty lines.
Created attachment 227250 [details] Patch
Comment on attachment 227250 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=227250&action=review > Source/WebCore/Modules/battery/BatteryManager.cpp:39 > - RefPtr<BatteryManager> batteryManager(adoptRef(new BatteryManager(navigator))); > + Ref<BatteryManager> batteryManager(adoptRef(*new BatteryManager(navigator))); > batteryManager->suspendIfNeeded(); > - return batteryManager.release(); > + return batteryManager.get(); This will ref() and deref() the object twice, it would be more efficient to write it like this: auto batteryManager = adoptRef(*new BatteryManager(navigator)); batteryManager.get().suspendIfNeeded(); return std::move(batteryManager);
(In reply to comment #2) > (From update of attachment 227250 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=227250&action=review > > > Source/WebCore/Modules/battery/BatteryManager.cpp:39 > > - RefPtr<BatteryManager> batteryManager(adoptRef(new BatteryManager(navigator))); > > + Ref<BatteryManager> batteryManager(adoptRef(*new BatteryManager(navigator))); > > batteryManager->suspendIfNeeded(); > > - return batteryManager.release(); > > + return batteryManager.get(); > > This will ref() and deref() the object twice, it would be more efficient to write it like this: > > auto batteryManager = adoptRef(*new BatteryManager(navigator)); > batteryManager.get().suspendIfNeeded(); > return std::move(batteryManager); Thanks for advice! I'll modify it.
Created attachment 227260 [details] Patch Applied Kling's comment.
Comment on attachment 227260 [details] Patch Clearing flags on attachment: 227260 Committed r165950: <http://trac.webkit.org/changeset/165950>
All reviewed patches have been landed. Closing bug.