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

Unified Diff: content/browser/device_orientation/data_fetcher_shared_memory_base.cc

Issue 152893002: [DeviceLight API] Content Side Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix in Java file, stop() Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/device_orientation/data_fetcher_shared_memory_base.cc
diff --git a/content/browser/device_orientation/data_fetcher_shared_memory_base.cc b/content/browser/device_orientation/data_fetcher_shared_memory_base.cc
index 690d1f8aa7f83e3b83369312efa102632434c837..01e9580944e38801b843cbfb994cc2a985f70ce9 100644
--- a/content/browser/device_orientation/data_fetcher_shared_memory_base.cc
+++ b/content/browser/device_orientation/data_fetcher_shared_memory_base.cc
@@ -9,6 +9,7 @@
#include "base/stl_util.h"
#include "base/threading/thread.h"
#include "base/timer/timer.h"
+#include "content/common/device_light/device_light_hardware_buffer.h"
#include "content/common/device_orientation/device_motion_hardware_buffer.h"
#include "content/common/device_orientation/device_orientation_hardware_buffer.h"
@@ -22,13 +23,15 @@ static size_t GetConsumerSharedMemoryBufferSize(ConsumerType consumer_type) {
return sizeof(DeviceMotionHardwareBuffer);
case CONSUMER_TYPE_ORIENTATION:
return sizeof(DeviceOrientationHardwareBuffer);
+ case CONSUMER_TYPE_LIGHT:
+ return sizeof(DeviceLightHardwareBuffer);
default:
NOTREACHED();
}
return 0;
}
-}
+} // namespace
class DataFetcherSharedMemoryBase::PollingThread : public base::Thread {
public:
@@ -42,7 +45,6 @@ class DataFetcherSharedMemoryBase::PollingThread : public base::Thread {
bool IsTimerRunning() const { return timer_ ? timer_->IsRunning() : false; }
private:
-
void DoPoll();
unsigned consumers_bitmask_;
@@ -89,7 +91,7 @@ void DataFetcherSharedMemoryBase::PollingThread::RemoveConsumer(
consumers_bitmask_ ^= consumer_type;
if (!consumers_bitmask_)
- timer_.reset(); // will also stop the timer.
+ timer_.reset(); // will also stop the timer.
}
void DataFetcherSharedMemoryBase::PollingThread::DoPoll() {
@@ -107,6 +109,7 @@ DataFetcherSharedMemoryBase::DataFetcherSharedMemoryBase()
DataFetcherSharedMemoryBase::~DataFetcherSharedMemoryBase() {
StopFetchingDeviceData(CONSUMER_TYPE_MOTION);
StopFetchingDeviceData(CONSUMER_TYPE_ORIENTATION);
+ StopFetchingDeviceData(CONSUMER_TYPE_LIGHT);
// make sure polling thread stops asap.
if (polling_thread_)

Powered by Google App Engine
This is Rietveld 408576698