[webkit-reviews] review granted: [Bug 130495] Refine BatteryStatus module : [Attachment 227250] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 19 23:07:31 PDT 2014


Andreas Kling <akling at apple.com> has granted Jinwoo Song
<jinwoo7.song at samsung.com>'s request for review:
Bug 130495: Refine BatteryStatus module
https://bugs.webkit.org/show_bug.cgi?id=130495

Attachment 227250: Patch
https://bugs.webkit.org/attachment.cgi?id=227250&action=review

------- Additional Comments from Andreas Kling <akling at apple.com>
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);


More information about the webkit-reviews mailing list