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

Side by Side Diff: content/browser/device_orientation/data_fetcher_impl_android.cc

Issue 10698046: Implements part of Device Motion in the Renderer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/device_orientation/data_fetcher_impl_android.h" 5 #include "content/browser/device_orientation/data_fetcher_impl_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/scoped_java_ref.h" 8 #include "base/android/scoped_java_ref.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return fetcher.release(); 47 return fetcher.release();
48 48
49 LOG(ERROR) << "DataFetcherImplAndroid::Start failed!"; 49 LOG(ERROR) << "DataFetcherImplAndroid::Start failed!";
50 return NULL; 50 return NULL;
51 } 51 }
52 52
53 DataFetcherImplAndroid::~DataFetcherImplAndroid() { 53 DataFetcherImplAndroid::~DataFetcherImplAndroid() {
54 Stop(); 54 Stop();
55 } 55 }
56 56
57 bool DataFetcherImplAndroid::GetMotion(Motion* motion) {
58 // TODO(aousterh): implement this
59 return false;
60 }
61
57 bool DataFetcherImplAndroid::GetOrientation(Orientation* orientation) { 62 bool DataFetcherImplAndroid::GetOrientation(Orientation* orientation) {
58 // Do we have a new orientation value? (It's safe to do this outside the lock 63 // Do we have a new orientation value? (It's safe to do this outside the lock
59 // because we only skip the lock if the value is null. We always enter the 64 // because we only skip the lock if the value is null. We always enter the
60 // lock if we're going to make use of the new value.) 65 // lock if we're going to make use of the new value.)
61 if (next_orientation_.get()) { 66 if (next_orientation_.get()) {
62 base::AutoLock autolock(next_orientation_lock_); 67 base::AutoLock autolock(next_orientation_lock_);
63 next_orientation_.swap(current_orientation_); 68 next_orientation_.swap(current_orientation_);
64 } 69 }
65 if (current_orientation_.get()) 70 if (current_orientation_.get())
66 *orientation = *current_orientation_; 71 *orientation = *current_orientation_;
(...skipping 14 matching lines...) Expand all
81 reinterpret_cast<jint>(this), 86 reinterpret_cast<jint>(this),
82 rate_in_milliseconds); 87 rate_in_milliseconds);
83 } 88 }
84 89
85 void DataFetcherImplAndroid::Stop() { 90 void DataFetcherImplAndroid::Stop() {
86 DCHECK(!g_jni_obj.Get().is_null()); 91 DCHECK(!g_jni_obj.Get().is_null());
87 Java_DeviceOrientation_stop(AttachCurrentThread(), g_jni_obj.Get().obj()); 92 Java_DeviceOrientation_stop(AttachCurrentThread(), g_jni_obj.Get().obj());
88 } 93 }
89 94
90 } // namespace device_orientation 95 } // namespace device_orientation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698