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

Side by Side Diff: content/browser/device_sensors/ambient_light_mac.cc

Issue 1579863003: Convert Pass()→std::move() for Mac build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 http://osxbook.com/book/bonus/chapter10/light/ 5 // This file is based on http://osxbook.com/book/bonus/chapter10/light/
6 6
7 #include "content/browser/device_sensors/ambient_light_mac.h" 7 #include "content/browser/device_sensors/ambient_light_mac.h"
8 8
9 #include <utility>
10
9 #include "base/mac/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
10 #include "base/mac/scoped_ioobject.h" 12 #include "base/mac/scoped_ioobject.h"
11 13
12 namespace content { 14 namespace content {
13 15
14 namespace { 16 namespace {
15 enum LmuFunctionIndex { 17 enum LmuFunctionIndex {
16 kGetSensorReadingID = 0, // getSensorReading(int *, int *) 18 kGetSensorReadingID = 0, // getSensorReading(int *, int *)
17 kGetLEDBrightnessID = 1, // getLEDBrightness(int, int *) 19 kGetLEDBrightnessID = 1, // getLEDBrightness(int, int *)
18 kSetLEDBrightnessID = 2, // setLEDBrightness(int, int, int *) 20 kSetLEDBrightnessID = 2, // setLEDBrightness(int, int, int *)
19 kSetLEDFadeID = 3, // setLEDFade(int, int, int, int *) 21 kSetLEDFadeID = 3, // setLEDFade(int, int, int, int *)
20 }; 22 };
21 } // namespace 23 } // namespace
22 24
23 // static 25 // static
24 scoped_ptr<AmbientLightSensor> AmbientLightSensor::Create() { 26 scoped_ptr<AmbientLightSensor> AmbientLightSensor::Create() {
25 scoped_ptr<AmbientLightSensor> light_sensor(new AmbientLightSensor); 27 scoped_ptr<AmbientLightSensor> light_sensor(new AmbientLightSensor);
26 return light_sensor->Init() ? light_sensor.Pass() : nullptr; 28 return light_sensor->Init() ? std::move(light_sensor) : nullptr;
27 } 29 }
28 30
29 AmbientLightSensor::~AmbientLightSensor() { 31 AmbientLightSensor::~AmbientLightSensor() {
30 if (!io_connection_) 32 if (!io_connection_)
31 IOServiceClose(io_connection_); 33 IOServiceClose(io_connection_);
32 } 34 }
33 35
34 AmbientLightSensor::AmbientLightSensor() : io_connection_(IO_OBJECT_NULL) { 36 AmbientLightSensor::AmbientLightSensor() : io_connection_(IO_OBJECT_NULL) {
35 } 37 }
36 38
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 bool AmbientLightSensor::ReadSensorValue(uint64_t lux_values[2]) { 71 bool AmbientLightSensor::ReadSensorValue(uint64_t lux_values[2]) {
70 uint32_t scalar_output_count = 2; 72 uint32_t scalar_output_count = 2;
71 kern_return_t kr = IOConnectCallMethod( 73 kern_return_t kr = IOConnectCallMethod(
72 io_connection_, LmuFunctionIndex::kGetSensorReadingID, nullptr, 0, 74 io_connection_, LmuFunctionIndex::kGetSensorReadingID, nullptr, 0,
73 nullptr, 0, lux_values, &scalar_output_count, nullptr, 0); 75 nullptr, 0, lux_values, &scalar_output_count, nullptr, 0);
74 76
75 return kr == KERN_SUCCESS; 77 return kr == KERN_SUCCESS;
76 } 78 }
77 79
78 } // namespace content 80 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698