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

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

Issue 11458003: Remove scoped_refptr::release which is confusing and causes leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 8 years 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
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/accelerometer_mac.h" 5 #include "content/browser/device_orientation/accelerometer_mac.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/browser/device_orientation/orientation.h" 10 #include "content/browser/device_orientation/orientation.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 static double just_less_than_90 = nextafter(90, 0); 86 static double just_less_than_90 = nextafter(90, 0);
87 orientation->set_gamma(just_less_than_90); 87 orientation->set_gamma(just_less_than_90);
88 } 88 }
89 89
90 // At this point, DCHECKing is paranoia. Never hurts. 90 // At this point, DCHECKing is paranoia. Never hurts.
91 DCHECK_GE(orientation->beta(), -180.0); 91 DCHECK_GE(orientation->beta(), -180.0);
92 DCHECK_LT(orientation->beta(), 180.0); 92 DCHECK_LT(orientation->beta(), 180.0);
93 DCHECK_GE(orientation->gamma(), -90.0); 93 DCHECK_GE(orientation->gamma(), -90.0);
94 DCHECK_LT(orientation->gamma(), 90.0); 94 DCHECK_LT(orientation->gamma(), 90.0);
95 95
96 return orientation.release(); 96 orientation->AddRef();
97 return orientation.get();
97 } 98 }
98 99
99 bool AccelerometerMac::Init() { 100 bool AccelerometerMac::Init() {
100 sudden_motion_sensor_.reset(SuddenMotionSensor::Create()); 101 sudden_motion_sensor_.reset(SuddenMotionSensor::Create());
101 return sudden_motion_sensor_.get() != NULL; 102 return sudden_motion_sensor_.get() != NULL;
102 } 103 }
103 104
104 } // namespace content 105 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698