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

Side by Side Diff: third_party/sudden_motion_sensor/sudden_motion_sensor_mac.cc

Issue 1911823002: Convert //third_party from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update crashpad's README.chromium Created 4 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
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 // This file is based on the SMSLib library. 5 // This file is based on the SMSLib library.
6 // 6 //
7 // SMSLib Sudden Motion Sensor Access Library 7 // SMSLib Sudden Motion Sensor Access Library
8 // Copyright (c) 2010 Suitable Systems 8 // Copyright (c) 2010 Suitable Systems
9 // All rights reserved. 9 // All rights reserved.
10 // 10 //
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // Suitable Systems 46 // Suitable Systems
47 // 1 Centre Street, Suite 204 47 // 1 Centre Street, Suite 204
48 // Wakefield, MA 01880 48 // Wakefield, MA 01880
49 // (781) 665-0053 49 // (781) 665-0053
50 50
51 #include "sudden_motion_sensor_mac.h" 51 #include "sudden_motion_sensor_mac.h"
52 52
53 #include <math.h> 53 #include <math.h>
54 #include <sys/sysctl.h> 54 #include <sys/sysctl.h>
55 55
56 #include <memory>
57
56 #include "base/logging.h" 58 #include "base/logging.h"
57 #include "base/mac/scoped_cftyperef.h" 59 #include "base/mac/scoped_cftyperef.h"
58 #include "base/memory/scoped_ptr.h"
59 60
60 struct SuddenMotionSensor::GenericMacbookSensor { 61 struct SuddenMotionSensor::GenericMacbookSensor {
61 // Name of device to be read. 62 // Name of device to be read.
62 const char* service_name; 63 const char* service_name;
63 64
64 // Number of bytes of the axis data. 65 // Number of bytes of the axis data.
65 int axis_size; 66 int axis_size;
66 67
67 // Default calibration value for zero g. 68 // Default calibration value for zero g.
68 float zero_g; 69 float zero_g;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 237
237 // Generic MacBook accelerometer sensor data, to be used for future models 238 // Generic MacBook accelerometer sensor data, to be used for future models
238 // as well as models for which it is verified to be correct. Note that this 239 // as well as models for which it is verified to be correct. Note that this
239 // configuration may have problems with inverted axes when used generically 240 // configuration may have problems with inverted axes when used generically
240 // for untested models. 241 // for untested models.
241 { "", NULL, { { 0, false }, { 2, false }, { 4, false } } } 242 { "", NULL, { { 0, false }, { 2, false }, { 4, false } } }
242 }; 243 };
243 244
244 // Create a SuddenMotionSensor object and return NULL if no valid sensor found. 245 // Create a SuddenMotionSensor object and return NULL if no valid sensor found.
245 SuddenMotionSensor* SuddenMotionSensor::Create() { 246 SuddenMotionSensor* SuddenMotionSensor::Create() {
246 scoped_ptr<SuddenMotionSensor> accelerometer(new SuddenMotionSensor); 247 std::unique_ptr<SuddenMotionSensor> accelerometer(new SuddenMotionSensor);
247 return accelerometer->Init() ? accelerometer.release() : NULL; 248 return accelerometer->Init() ? accelerometer.release() : NULL;
248 } 249 }
249 250
250 SuddenMotionSensor::~SuddenMotionSensor() { 251 SuddenMotionSensor::~SuddenMotionSensor() {
251 IOServiceClose(io_connection_); 252 IOServiceClose(io_connection_);
252 } 253 }
253 254
254 SuddenMotionSensor::SuddenMotionSensor() 255 SuddenMotionSensor::SuddenMotionSensor()
255 : sensor_(NULL), 256 : sensor_(NULL),
256 io_connection_(0) { 257 io_connection_(0) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 if (value & 0x00800000) 424 if (value & 0x00800000)
424 return value | 0xff000000; 425 return value | 0xff000000;
425 break; 426 break;
426 427
427 default: 428 default:
428 LOG(FATAL) << "Invalid integer size for sign extension: " << size; 429 LOG(FATAL) << "Invalid integer size for sign extension: " << size;
429 } 430 }
430 431
431 return value; 432 return value;
432 } 433 }
OLDNEW
« no previous file with comments | « third_party/libaddressinput/chromium/string_compare.cc ('k') | third_party/zlib/google/zip_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698