| Index: content/renderer/renderer_blink_platform_impl.cc
|
| diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
|
| index a043d1bb5ac6af73421e039844b2ee0ea8df81a7..242a5950a3c6cca3b1b844a75efd806d3955dfcf 100644
|
| --- a/content/renderer/renderer_blink_platform_impl.cc
|
| +++ b/content/renderer/renderer_blink_platform_impl.cc
|
| @@ -1045,34 +1045,39 @@
|
| // hardware changes. In order to make that happen, they will receive a null
|
| // thread.
|
| if (thread && RenderThreadImpl::current()->layout_test_mode())
|
| - thread = NULL;
|
| + thread = 0;
|
|
|
| switch (type) {
|
| - case blink::WebPlatformEventDeviceMotion:
|
| - return new DeviceMotionEventPump(thread);
|
| - case blink::WebPlatformEventDeviceOrientation:
|
| - return new DeviceOrientationEventPump(thread);
|
| - case blink::WebPlatformEventDeviceLight:
|
| - return new DeviceLightEventPump(thread);
|
| - case blink::WebPlatformEventGamepad:
|
| - return new GamepadSharedMemoryReader(thread);
|
| - case blink::WebPlatformEventScreenOrientation:
|
| - return new ScreenOrientationObserver();
|
| - default:
|
| - // A default statement is required to prevent compilation errors when
|
| - // Blink adds a new type.
|
| - VLOG(1) << "RendererBlinkPlatformImpl::startListening() with "
|
| - "unknown type.";
|
| - }
|
| -
|
| - return NULL;
|
| + case blink::WebPlatformEventDeviceMotion: {
|
| + return new DeviceMotionEventPump(thread);
|
| + }
|
| + case blink::WebPlatformEventDeviceOrientation: {
|
| + return new DeviceOrientationEventPump(thread);
|
| + }
|
| + case blink::WebPlatformEventDeviceLight: {
|
| + return new DeviceLightEventPump(thread);
|
| + }
|
| + case blink::WebPlatformEventBattery: {
|
| + return new BatteryStatusDispatcher(thread);
|
| + }
|
| + case blink::WebPlatformEventGamepad:
|
| + return new GamepadSharedMemoryReader(thread);
|
| + break;
|
| + case blink::WebPlatformEventScreenOrientation:
|
| + return new ScreenOrientationObserver();
|
| + default:
|
| + // A default statement is required to prevent compilation errors when Blink
|
| + // adds a new type.
|
| + VLOG(1) << "RendererBlinkPlatformImpl::startListening() with "
|
| + "unknown type.";
|
| + }
|
| +
|
| + return 0;
|
| }
|
|
|
| void RendererBlinkPlatformImpl::SetPlatformEventObserverForTesting(
|
| blink::WebPlatformEventType type,
|
| scoped_ptr<PlatformEventObserverBase> observer) {
|
| - DCHECK(type != blink::WebPlatformEventBattery);
|
| -
|
| if (platform_event_observers_.Lookup(type))
|
| platform_event_observers_.Remove(type);
|
| platform_event_observers_.AddWithID(observer.release(), type);
|
| @@ -1081,12 +1086,6 @@
|
| void RendererBlinkPlatformImpl::startListening(
|
| blink::WebPlatformEventType type,
|
| blink::WebPlatformEventListener* listener) {
|
| - if (type == blink::WebPlatformEventBattery) {
|
| - battery_status_dispatcher_.reset(new BatteryStatusDispatcher(
|
| - static_cast<blink::WebBatteryStatusListener*>(listener)));
|
| - return;
|
| - }
|
| -
|
| PlatformEventObserverBase* observer = platform_event_observers_.Lookup(type);
|
| if (!observer) {
|
| observer = CreatePlatformEventObserverFromType(type);
|
| @@ -1145,11 +1144,6 @@
|
|
|
| void RendererBlinkPlatformImpl::stopListening(
|
| blink::WebPlatformEventType type) {
|
| - if (type == blink::WebPlatformEventBattery) {
|
| - battery_status_dispatcher_.reset();
|
| - return;
|
| - }
|
| -
|
| PlatformEventObserverBase* observer = platform_event_observers_.Lookup(type);
|
| if (!observer)
|
| return;
|
|
|