OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "data_fetcher_shared_memory.h" | 5 #include "data_fetcher_shared_memory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 namespace content { | 34 namespace content { |
35 | 35 |
36 DataFetcherSharedMemory::DataFetcherSharedMemory() | 36 DataFetcherSharedMemory::DataFetcherSharedMemory() |
37 : motion_buffer_(NULL), orientation_buffer_(NULL) { | 37 : motion_buffer_(NULL), orientation_buffer_(NULL) { |
38 } | 38 } |
39 | 39 |
40 DataFetcherSharedMemory::~DataFetcherSharedMemory() { | 40 DataFetcherSharedMemory::~DataFetcherSharedMemory() { |
| 41 StopFetchingAllDeviceData(); |
41 } | 42 } |
42 | 43 |
43 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { | 44 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { |
44 DCHECK(buffer); | 45 DCHECK(buffer); |
45 | 46 |
46 switch (consumer_type) { | 47 switch (consumer_type) { |
47 case CONSUMER_TYPE_MOTION: | 48 case CONSUMER_TYPE_MOTION: |
48 motion_buffer_ = static_cast<DeviceMotionHardwareBuffer*>(buffer); | 49 motion_buffer_ = static_cast<DeviceMotionHardwareBuffer*>(buffer); |
49 UMA_HISTOGRAM_BOOLEAN("InertialSensor.MotionDefaultAvailable", false); | 50 UMA_HISTOGRAM_BOOLEAN("InertialSensor.MotionDefaultAvailable", false); |
50 return SetMotionBuffer(motion_buffer_, true); | 51 return SetMotionBuffer(motion_buffer_, true); |
(...skipping 15 matching lines...) Expand all Loading... |
66 return SetMotionBuffer(motion_buffer_, false); | 67 return SetMotionBuffer(motion_buffer_, false); |
67 case CONSUMER_TYPE_ORIENTATION: | 68 case CONSUMER_TYPE_ORIENTATION: |
68 return SetOrientationBuffer(orientation_buffer_, false); | 69 return SetOrientationBuffer(orientation_buffer_, false); |
69 default: | 70 default: |
70 NOTREACHED(); | 71 NOTREACHED(); |
71 } | 72 } |
72 return false; | 73 return false; |
73 } | 74 } |
74 | 75 |
75 } // namespace content | 76 } // namespace content |
OLD | NEW |