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

Unified Diff: content/renderer/device_orientation_dispatcher.cc

Issue 10542025: Changed device_orientation_dispatcher to use default constructor in WebDeviceOrientation.h. This de… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed review comments Created 8 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
« no previous file with comments | « content/renderer/device_orientation_dispatcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/device_orientation_dispatcher.cc
diff --git a/content/renderer/device_orientation_dispatcher.cc b/content/renderer/device_orientation_dispatcher.cc
index a0a66a460a6825d58213559995d34186ce117430..42ce18dfa9c8ace26240343509550c180eaf772d 100644
--- a/content/renderer/device_orientation_dispatcher.cc
+++ b/content/renderer/device_orientation_dispatcher.cc
@@ -48,10 +48,7 @@ void DeviceOrientationDispatcher::stopUpdating() {
WebKit::WebDeviceOrientation DeviceOrientationDispatcher::lastOrientation()
const {
- if (!last_orientation_.get())
- return WebKit::WebDeviceOrientation::nullOrientation();
-
- return *last_orientation_;
+ return last_orientation_;
}
namespace {
@@ -80,17 +77,17 @@ bool OrientationsEqual(const DeviceOrientationMsg_Updated_Params& a,
void DeviceOrientationDispatcher::OnDeviceOrientationUpdated(
const DeviceOrientationMsg_Updated_Params& p) {
- if (last_orientation_.get() && OrientationsEqual(p, last_orientation_.get()))
+ if (!last_orientation_.isNull() && OrientationsEqual(p, &last_orientation_))
return;
- last_orientation_.reset(new WebKit::WebDeviceOrientation(p.can_provide_alpha,
- p.alpha,
- p.can_provide_beta,
- p.beta,
- p.can_provide_gamma,
- p.gamma,
- p.can_provide_absolute,
- p.absolute));
-
- controller_->didChangeDeviceOrientation(*last_orientation_);
+ last_orientation_.setNull(false);
+ if (p.can_provide_alpha)
+ last_orientation_.setAlpha(p.alpha);
+ if (p.can_provide_beta)
+ last_orientation_.setBeta(p.beta);
+ if (p.can_provide_gamma)
+ last_orientation_.setGamma(p.gamma);
+ if (p.can_provide_absolute)
+ last_orientation_.setAbsolute(p.absolute);
+ controller_->didChangeDeviceOrientation(last_orientation_);
}
« no previous file with comments | « content/renderer/device_orientation_dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698