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

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

Issue 19833005: Implement PollingThread for Device Motion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed compilation issues Created 7 years, 5 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 8
9 namespace content { 9 namespace content {
10 10
11 DataFetcherSharedMemory::~DataFetcherSharedMemory() { 11 DataFetcherSharedMemory::~DataFetcherSharedMemory() {
12 StopFetchingDeviceMotionData(); 12 if (started_)
13 StopFetchingDeviceMotionData();
piman 2013/07/26 17:47:48 nit: indent
timvolodine 2013/07/29 12:06:25 Done.
13 } 14 }
14 15
15 bool DataFetcherSharedMemory::NeedsPolling() { 16 bool DataFetcherSharedMemory::NeedsPolling() {
16 return false; 17 return false;
17 } 18 }
18 19
19 bool DataFetcherSharedMemory::FetchDeviceMotionDataIntoBuffer() { 20 bool DataFetcherSharedMemory::FetchDeviceMotionDataIntoBuffer() {
20 NOTREACHED(); 21 NOTREACHED();
21 return false; 22 return false;
22 } 23 }
23 24
24 bool DataFetcherSharedMemory::StartFetchingDeviceMotionData( 25 bool DataFetcherSharedMemory::StartFetchingDeviceMotionData(
25 DeviceMotionHardwareBuffer* buffer) { 26 DeviceMotionHardwareBuffer* buffer) {
26 DCHECK(buffer); 27 DCHECK(buffer);
28 device_motion_buffer_ = buffer;
27 device_motion_buffer_->seqlock.WriteBegin(); 29 device_motion_buffer_->seqlock.WriteBegin();
28 device_motion_buffer_->data.allAvailableSensorsAreActive = true; 30 device_motion_buffer_->data.allAvailableSensorsAreActive = true;
29 device_motion_buffer_->seqlock.WriteEnd(); 31 device_motion_buffer_->seqlock.WriteEnd();
32 started_ = true;
30 return true; 33 return true;
31 } 34 }
32 35
33 void DataFetcherSharedMemory::StopFetchingDeviceMotionData() { 36 void DataFetcherSharedMemory::StopFetchingDeviceMotionData() {
34 device_motion_buffer_->seqlock.WriteBegin(); 37 device_motion_buffer_->seqlock.WriteBegin();
35 device_motion_buffer_->data.allAvailableSensorsAreActive = false; 38 device_motion_buffer_->data.allAvailableSensorsAreActive = false;
36 device_motion_buffer_->seqlock.WriteEnd(); 39 device_motion_buffer_->seqlock.WriteEnd();
40 started_ = false;
37 } 41 }
38 42
39 } // namespace content 43 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698