Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(915)

Unified Diff: content/renderer/device_sensors/device_motion_event_pump.cc

Issue 2037513002: Convert device_sensors to use mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@conversion--mime-registry
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/device_sensors/device_motion_event_pump.cc
diff --git a/content/renderer/device_sensors/device_motion_event_pump.cc b/content/renderer/device_sensors/device_motion_event_pump.cc
index 860cf68e2f16fb18b13f6d794e047f229991d468..125b2a2051afc06fe84d30ce6ec3ce0ba912a623 100644
--- a/content/renderer/device_sensors/device_motion_event_pump.cc
+++ b/content/renderer/device_sensors/device_motion_event_pump.cc
@@ -4,34 +4,26 @@
#include "device_motion_event_pump.h"
-#include "content/common/device_sensors/device_motion_messages.h"
#include "content/public/renderer/render_thread.h"
#include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionListener.h"
namespace content {
DeviceMotionEventPump::DeviceMotionEventPump(RenderThread* thread)
- : DeviceSensorEventPump<blink::WebDeviceMotionListener>(thread) {
-}
+ : DeviceMojoClientMixin<
+ DeviceSensorEventPump<blink::WebDeviceMotionListener>,
+ device::mojom::MotionSensor>(thread) {}
DeviceMotionEventPump::~DeviceMotionEventPump() {
}
-bool DeviceMotionEventPump::OnControlMessageReceived(
- const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(DeviceMotionEventPump, message)
- IPC_MESSAGE_HANDLER(DeviceMotionMsg_DidStartPolling, OnDidStart)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
void DeviceMotionEventPump::FireEvent() {
DCHECK(listener());
blink::WebDeviceMotionData data;
- if (reader_->GetLatestData(&data) && data.allAvailableSensorsAreActive)
+ if (!using_fake_data_for_testing_ && reader_->GetLatestData(&data) &&
timvolodine 2016/06/09 17:43:47 don't think this should be called in testing mode
Sam McNally 2016/06/10 01:07:51 Done. Previously, I hadn't replicated the testing
+ data.allAvailableSensorsAreActive) {
listener()->didChangeDeviceMotion(data);
+ }
}
bool DeviceMotionEventPump::InitializeReader(base::SharedMemoryHandle handle) {
@@ -40,15 +32,8 @@ bool DeviceMotionEventPump::InitializeReader(base::SharedMemoryHandle handle) {
return reader_->Initialize(handle);
}
-void DeviceMotionEventPump::SendStartMessage() {
- RenderThread::Get()->Send(new DeviceMotionHostMsg_StartPolling());
-}
-
-void DeviceMotionEventPump::SendStopMessage() {
- RenderThread::Get()->Send(new DeviceMotionHostMsg_StopPolling());
-}
-
void DeviceMotionEventPump::SendFakeDataForTesting(void* fake_data) {
+ using_fake_data_for_testing_ = true;
blink::WebDeviceMotionData data =
*static_cast<blink::WebDeviceMotionData*>(fake_data);

Powered by Google App Engine
This is Rietveld 408576698