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

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

Issue 856123002: Device Orientation API on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/device_sensors/data_fetcher_shared_memory.h"
6
7 #include "content/browser/device_sensors/sensor_manager_chromeos.h"
8
9 namespace content {
10
11 DataFetcherSharedMemory::DataFetcherSharedMemory() {
12 }
13
14 DataFetcherSharedMemory::~DataFetcherSharedMemory() {
15 }
16
17 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
18 DCHECK(buffer);
19 if (!sensor_manager_.get())
timvolodine 2015/01/21 13:16:57 nit: think you can drop ".get" which results in sh
jonross 2015/01/21 16:02:10 Done.
20 sensor_manager_.reset(new SensorManagerChromeOS);
21
22 switch (consumer_type) {
23 case CONSUMER_TYPE_MOTION:
timvolodine 2015/01/21 13:16:57 is there a todo needed here? any relevant crbug?
jonross 2015/01/21 16:02:10 Added a TODO with relevant CR bug
24 return false;
25 case CONSUMER_TYPE_ORIENTATION:
26 return sensor_manager_->StartFetchingDeviceOrientationData(
27 static_cast<DeviceOrientationHardwareBuffer*>(buffer));
28 case CONSUMER_TYPE_LIGHT:
29 return false;
30 default:
31 NOTREACHED();
32 }
33 return false;
34 }
35
36 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
37 bool stopped = false;
38 switch (consumer_type) {
39 case CONSUMER_TYPE_MOTION:
40 break;
41 case CONSUMER_TYPE_ORIENTATION:
42 stopped = sensor_manager_->StopFetchingDeviceOrientationData();
43 break;
44 case CONSUMER_TYPE_LIGHT:
45 break;
46 default:
47 NOTREACHED();
48 }
49 if (!sensor_manager_->IsFetching())
50 sensor_manager_.reset();
51 return stopped;
52 }
53
54 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698