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

Unified Diff: content/browser/device_orientation/data_fetcher_impl_android.cc

Issue 10755002: Refactors DeviceOrientation to make it more extensible (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Small changes to appease try bots Created 8 years, 4 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/browser/device_orientation/data_fetcher_impl_android.cc
diff --git a/content/browser/device_orientation/data_fetcher_impl_android.cc b/content/browser/device_orientation/data_fetcher_impl_android.cc
index e51af51370e17c86803045e94fcd27d8c936c66f..3a0aedd84ca4fdef9050d468009619177d96dfa5 100644
--- a/content/browser/device_orientation/data_fetcher_impl_android.cc
+++ b/content/browser/device_orientation/data_fetcher_impl_android.cc
@@ -54,7 +54,14 @@ DataFetcherImplAndroid::~DataFetcherImplAndroid() {
Stop();
}
-bool DataFetcherImplAndroid::GetOrientation(Orientation* orientation) {
+const DeviceData* DataFetcherImplAndroid::GetDeviceData(
+ DeviceData::Type type) {
+ if (type != DeviceData::kTypeOrientation)
+ return NULL;
+ return GetOrientation();
+}
+
+const Orientation* DataFetcherImplAndroid::GetOrientation() {
// Do we have a new orientation value? (It's safe to do this outside the lock
// because we only skip the lock if the value is null. We always enter the
// lock if we're going to make use of the new value.)
@@ -62,9 +69,9 @@ bool DataFetcherImplAndroid::GetOrientation(Orientation* orientation) {
base::AutoLock autolock(next_orientation_lock_);
next_orientation_.swap(current_orientation_);
}
- if (current_orientation_.get())
- *orientation = *current_orientation_;
- return true;
+ if (!current_orientation_.get())
+ return new Orientation();
+ return current_orientation_.get();
}
void DataFetcherImplAndroid::GotOrientation(
@@ -76,7 +83,7 @@ void DataFetcherImplAndroid::GotOrientation(
orientation->set_beta(beta);
orientation->set_gamma(gamma);
orientation->set_absolute(true);
- next_orientation_.reset(orientation);
+ next_orientation_ = orientation;
}
bool DataFetcherImplAndroid::Start(int rate_in_milliseconds) {
« no previous file with comments | « content/browser/device_orientation/data_fetcher_impl_android.h ('k') | content/browser/device_orientation/device_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698