Commit 2d97d1fd authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

[Device Orientation] Make the return value of DeviceMotionDispatcher::LastestDeviceMotionData const

The issue 233174 was filed 4 years ago though, it hasn't been started yet. This CL makes the return
value const, then change some arguments of callers to const according to the change of return value
type.

Bug: 233174
Change-Id: Ib08dc2b7dff417bf99da5a82fc1994131fec399e
Reviewed-on: https://chromium-review.googlesource.com/821338Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung.kim@lge.com>
Cr-Commit-Position: refs/heads/master@{#524000}
parent 7b19341c
...@@ -66,7 +66,7 @@ void DeviceMotionDispatcher::DidChangeDeviceMotion( ...@@ -66,7 +66,7 @@ void DeviceMotionDispatcher::DidChangeDeviceMotion(
NotifyControllers(); NotifyControllers();
} }
DeviceMotionData* DeviceMotionDispatcher::LatestDeviceMotionData() { const DeviceMotionData* DeviceMotionDispatcher::LatestDeviceMotionData() {
return last_device_motion_data_.Get(); return last_device_motion_data_.Get();
} }
......
...@@ -57,8 +57,7 @@ class DeviceMotionDispatcher final ...@@ -57,8 +57,7 @@ class DeviceMotionDispatcher final
~DeviceMotionDispatcher() override; ~DeviceMotionDispatcher() override;
// Note that the returned object is owned by this class. // Note that the returned object is owned by this class.
// FIXME: make the return value const, see crbug.com/233174. const DeviceMotionData* LatestDeviceMotionData();
DeviceMotionData* LatestDeviceMotionData();
// Inherited from WebDeviceMotionListener. // Inherited from WebDeviceMotionListener.
void DidChangeDeviceMotion(const device::MotionData&) override; void DidChangeDeviceMotion(const device::MotionData&) override;
......
...@@ -43,7 +43,7 @@ DeviceMotionEvent::DeviceMotionEvent(const AtomicString& event_type, ...@@ -43,7 +43,7 @@ DeviceMotionEvent::DeviceMotionEvent(const AtomicString& event_type,
device_motion_data_(DeviceMotionData::Create(initializer)) {} device_motion_data_(DeviceMotionData::Create(initializer)) {}
DeviceMotionEvent::DeviceMotionEvent(const AtomicString& event_type, DeviceMotionEvent::DeviceMotionEvent(const AtomicString& event_type,
DeviceMotionData* device_motion_data) const DeviceMotionData* device_motion_data)
: Event(event_type, false, false), // Can't bubble, not cancelable : Event(event_type, false, false), // Can't bubble, not cancelable
device_motion_data_(device_motion_data) {} device_motion_data_(device_motion_data) {}
......
...@@ -47,11 +47,11 @@ class DeviceMotionEvent final : public Event { ...@@ -47,11 +47,11 @@ class DeviceMotionEvent final : public Event {
return new DeviceMotionEvent(event_type, initializer); return new DeviceMotionEvent(event_type, initializer);
} }
static DeviceMotionEvent* Create(const AtomicString& event_type, static DeviceMotionEvent* Create(const AtomicString& event_type,
DeviceMotionData* device_motion_data) { const DeviceMotionData* device_motion_data) {
return new DeviceMotionEvent(event_type, device_motion_data); return new DeviceMotionEvent(event_type, device_motion_data);
} }
DeviceMotionData* GetDeviceMotionData() const { const DeviceMotionData* GetDeviceMotionData() const {
return device_motion_data_.Get(); return device_motion_data_.Get();
} }
...@@ -67,9 +67,9 @@ class DeviceMotionEvent final : public Event { ...@@ -67,9 +67,9 @@ class DeviceMotionEvent final : public Event {
private: private:
DeviceMotionEvent(); DeviceMotionEvent();
DeviceMotionEvent(const AtomicString&, const DeviceMotionEventInit&); DeviceMotionEvent(const AtomicString&, const DeviceMotionEventInit&);
DeviceMotionEvent(const AtomicString& event_type, DeviceMotionData*); DeviceMotionEvent(const AtomicString& event_type, const DeviceMotionData*);
Member<DeviceMotionData> device_motion_data_; Member<const DeviceMotionData> device_motion_data_;
Member<DeviceAcceleration> acceleration_; Member<DeviceAcceleration> acceleration_;
Member<DeviceAcceleration> acceleration_including_gravity_; Member<DeviceAcceleration> acceleration_including_gravity_;
Member<DeviceRotationRate> rotation_rate_; Member<DeviceRotationRate> rotation_rate_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment