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

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

Issue 23441047: Fix race condition in DataFetcherSharedMemoryBase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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 "content/browser/device_orientation/data_fetcher_shared_memory.h" 5 #include "content/browser/device_orientation/data_fetcher_shared_memory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/device_orientation/data_fetcher_impl_android.h" 8 #include "content/browser/device_orientation/data_fetcher_impl_android.h"
9 #include "content/common/device_motion_hardware_buffer.h" 9 #include "content/common/device_motion_hardware_buffer.h"
10 #include "content/common/device_orientation/device_orientation_hardware_buffer.h " 10 #include "content/common/device_orientation/device_orientation_hardware_buffer.h "
11 11
12 namespace content { 12 namespace content {
13 13
14 DataFetcherSharedMemory::DataFetcherSharedMemory() { 14 DataFetcherSharedMemory::DataFetcherSharedMemory() {
15 } 15 }
16 16
17 DataFetcherSharedMemory::~DataFetcherSharedMemory() { 17 DataFetcherSharedMemory::~DataFetcherSharedMemory() {
18 } 18 }
19 19
20 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type) { 20 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
21 void* buffer = GetSharedMemoryBuffer(consumer_type);
22 DCHECK(buffer); 21 DCHECK(buffer);
23 22
24 switch (consumer_type) { 23 switch (consumer_type) {
25 case CONSUMER_TYPE_MOTION: 24 case CONSUMER_TYPE_MOTION:
26 return DataFetcherImplAndroid::GetInstance()-> 25 return DataFetcherImplAndroid::GetInstance()->
27 StartFetchingDeviceMotionData( 26 StartFetchingDeviceMotionData(
28 static_cast<DeviceMotionHardwareBuffer*>(buffer)); 27 static_cast<DeviceMotionHardwareBuffer*>(buffer));
29 case CONSUMER_TYPE_ORIENTATION: 28 case CONSUMER_TYPE_ORIENTATION:
30 return DataFetcherImplAndroid::GetInstance()-> 29 return DataFetcherImplAndroid::GetInstance()->
31 StartFetchingDeviceOrientationData( 30 StartFetchingDeviceOrientationData(
(...skipping 13 matching lines...) Expand all
45 DataFetcherImplAndroid::GetInstance()-> 44 DataFetcherImplAndroid::GetInstance()->
46 StopFetchingDeviceOrientationData(); 45 StopFetchingDeviceOrientationData();
47 return true; 46 return true;
48 default: 47 default:
49 NOTREACHED(); 48 NOTREACHED();
50 } 49 }
51 return false; 50 return false;
52 } 51 }
53 52
54 } // namespace content 53 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698