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

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

Issue 236833003: Rename device_orientation to device_sensors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 11 matching lines...) Expand all
22 static bool SetOrientationBuffer( 22 static bool SetOrientationBuffer(
23 content::DeviceOrientationHardwareBuffer* buffer, bool enabled) { 23 content::DeviceOrientationHardwareBuffer* buffer, bool enabled) {
24 if (!buffer) 24 if (!buffer)
25 return false; 25 return false;
26 buffer->seqlock.WriteBegin(); 26 buffer->seqlock.WriteBegin();
27 buffer->data.allAvailableSensorsAreActive = enabled; 27 buffer->data.allAvailableSensorsAreActive = enabled;
28 buffer->seqlock.WriteEnd(); 28 buffer->seqlock.WriteEnd();
29 return true; 29 return true;
30 } 30 }
31 31
32 } 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 } 41 }
42 42
(...skipping 11 matching lines...) Expand all
54 UMA_HISTOGRAM_BOOLEAN("InertialSensor.OrientationDefaultAvailable", 54 UMA_HISTOGRAM_BOOLEAN("InertialSensor.OrientationDefaultAvailable",
55 false); 55 false);
56 return SetOrientationBuffer(orientation_buffer_, true); 56 return SetOrientationBuffer(orientation_buffer_, true);
57 default: 57 default:
58 NOTREACHED(); 58 NOTREACHED();
59 } 59 }
60 return false; 60 return false;
61 } 61 }
62 62
63 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { 63 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
64
65 switch (consumer_type) { 64 switch (consumer_type) {
66 case CONSUMER_TYPE_MOTION: 65 case CONSUMER_TYPE_MOTION:
67 return SetMotionBuffer(motion_buffer_, false); 66 return SetMotionBuffer(motion_buffer_, false);
68 case CONSUMER_TYPE_ORIENTATION: 67 case CONSUMER_TYPE_ORIENTATION:
69 return SetOrientationBuffer(orientation_buffer_, false); 68 return SetOrientationBuffer(orientation_buffer_, false);
70 default: 69 default:
71 NOTREACHED(); 70 NOTREACHED();
72 } 71 }
73 return false; 72 return false;
74 } 73 }
75 74
76 } // namespace content 75 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698