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

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

Issue 14081010: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some gtk issues Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/byte_stream.cc ('k') | content/browser/device_orientation/observer_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/logging.h" 8 #include "base/logging.h"
9 #include "content/browser/device_orientation/orientation.h" 9 #include "content/browser/device_orientation/orientation.h"
10 #include "jni/DeviceMotionAndOrientation_jni.h" 10 #include "jni/DeviceMotionAndOrientation_jni.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 DeviceData::Type type) { 52 DeviceData::Type type) {
53 if (type != DeviceData::kTypeOrientation) 53 if (type != DeviceData::kTypeOrientation)
54 return NULL; 54 return NULL;
55 return GetOrientation(); 55 return GetOrientation();
56 } 56 }
57 57
58 const Orientation* DataFetcherImplAndroid::GetOrientation() { 58 const Orientation* DataFetcherImplAndroid::GetOrientation() {
59 // Do we have a new orientation value? (It's safe to do this outside the lock 59 // Do we have a new orientation value? (It's safe to do this outside the lock
60 // because we only skip the lock if the value is null. We always enter the 60 // because we only skip the lock if the value is null. We always enter the
61 // lock if we're going to make use of the new value.) 61 // lock if we're going to make use of the new value.)
62 if (next_orientation_.get()) { 62 if (next_orientation_) {
63 base::AutoLock autolock(next_orientation_lock_); 63 base::AutoLock autolock(next_orientation_lock_);
64 next_orientation_.swap(current_orientation_); 64 next_orientation_.swap(current_orientation_);
65 } 65 }
66 if (!current_orientation_.get()) 66 if (!current_orientation_)
67 return new Orientation(); 67 return new Orientation();
68 return current_orientation_.get(); 68 return current_orientation_.get();
69 } 69 }
70 70
71 void DataFetcherImplAndroid::GotOrientation( 71 void DataFetcherImplAndroid::GotOrientation(
72 JNIEnv*, jobject, double alpha, double beta, double gamma) { 72 JNIEnv*, jobject, double alpha, double beta, double gamma) {
73 base::AutoLock autolock(next_orientation_lock_); 73 base::AutoLock autolock(next_orientation_lock_);
74 74
75 Orientation* orientation = new Orientation(); 75 Orientation* orientation = new Orientation();
76 orientation->set_alpha(alpha); 76 orientation->set_alpha(alpha);
(...skipping 28 matching lines...) Expand all
105 } 105 }
106 106
107 void DataFetcherImplAndroid::Stop(DeviceData::Type event_type) { 107 void DataFetcherImplAndroid::Stop(DeviceData::Type event_type) {
108 DCHECK(!device_orientation_.is_null()); 108 DCHECK(!device_orientation_.is_null());
109 Java_DeviceMotionAndOrientation_stop( 109 Java_DeviceMotionAndOrientation_stop(
110 AttachCurrentThread(), device_orientation_.obj(), 110 AttachCurrentThread(), device_orientation_.obj(),
111 static_cast<jint>(event_type)); 111 static_cast<jint>(event_type));
112 } 112 }
113 113
114 } // namespace content 114 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/byte_stream.cc ('k') | content/browser/device_orientation/observer_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698