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

Unified Diff: device/device_sensors/data_fetcher_shared_memory_base.cc

Issue 1164563003: Extract device_sensors to /device via Mojofication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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: device/device_sensors/data_fetcher_shared_memory_base.cc
diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_base.cc b/device/device_sensors/data_fetcher_shared_memory_base.cc
similarity index 82%
rename from content/browser/device_sensors/data_fetcher_shared_memory_base.cc
rename to device/device_sensors/data_fetcher_shared_memory_base.cc
index f2b2d40c6431a251c34b5015dc01f3b5def37211..47456235cb5ce9b850ef2cc106adbbbb2ee66ba1 100644
--- a/content/browser/device_sensors/data_fetcher_shared_memory_base.cc
+++ b/device/device_sensors/data_fetcher_shared_memory_base.cc
@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/device_sensors/data_fetcher_shared_memory_base.h"
+#include "device/device_sensors/data_fetcher_shared_memory_base.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/threading/thread.h"
#include "base/timer/timer.h"
-#include "content/common/device_sensors/device_light_hardware_buffer.h"
-#include "content/common/device_sensors/device_motion_hardware_buffer.h"
-#include "content/common/device_sensors/device_orientation_hardware_buffer.h"
+#include "device/device_sensors/device_light_hardware_buffer.h"
+#include "device/device_sensors/device_motion_hardware_buffer.h"
+#include "device/device_sensors/device_orientation_hardware_buffer.h"
-namespace content {
+namespace device {
namespace {
@@ -49,7 +49,7 @@ class DataFetcherSharedMemoryBase::PollingThread : public base::Thread {
unsigned consumers_bitmask_;
DataFetcherSharedMemoryBase* fetcher_;
- scoped_ptr<base::RepeatingTimer<PollingThread> > timer_;
+ scoped_ptr<base::RepeatingTimer<PollingThread>> timer_;
DISALLOW_COPY_AND_ASSIGN(PollingThread);
};
@@ -57,17 +57,17 @@ class DataFetcherSharedMemoryBase::PollingThread : public base::Thread {
// --- PollingThread methods
DataFetcherSharedMemoryBase::PollingThread::PollingThread(
- const char* name, DataFetcherSharedMemoryBase* fetcher)
- : base::Thread(name),
- consumers_bitmask_(0),
- fetcher_(fetcher) {
+ const char* name,
+ DataFetcherSharedMemoryBase* fetcher)
+ : base::Thread(name), consumers_bitmask_(0), fetcher_(fetcher) {
}
DataFetcherSharedMemoryBase::PollingThread::~PollingThread() {
}
void DataFetcherSharedMemoryBase::PollingThread::AddConsumer(
- ConsumerType consumer_type, void* buffer) {
+ ConsumerType consumer_type,
+ void* buffer) {
DCHECK(fetcher_);
if (!fetcher_->Start(consumer_type, buffer))
return;
@@ -76,9 +76,8 @@ void DataFetcherSharedMemoryBase::PollingThread::AddConsumer(
if (!timer_ && fetcher_->GetType() == FETCHER_TYPE_POLLING_CALLBACK) {
timer_.reset(new base::RepeatingTimer<PollingThread>());
- timer_->Start(FROM_HERE,
- fetcher_->GetInterval(),
- this, &PollingThread::DoPoll);
+ timer_->Start(FROM_HERE, fetcher_->GetInterval(), this,
+ &PollingThread::DoPoll);
}
}
@@ -114,7 +113,7 @@ DataFetcherSharedMemoryBase::~DataFetcherSharedMemoryBase() {
polling_thread_->Stop();
STLDeleteContainerPairSecondPointers(shared_memory_map_.begin(),
- shared_memory_map_.end());
+ shared_memory_map_.end());
}
bool DataFetcherSharedMemoryBase::StartFetchingDeviceData(
@@ -130,10 +129,9 @@ bool DataFetcherSharedMemoryBase::StartFetchingDeviceData(
if (!InitAndStartPollingThreadIfNecessary())
return false;
polling_thread_->message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&PollingThread::AddConsumer,
- base::Unretained(polling_thread_.get()),
- consumer_type, buffer));
+ FROM_HERE, base::Bind(&PollingThread::AddConsumer,
+ base::Unretained(polling_thread_.get()),
+ consumer_type, buffer));
} else {
if (!Start(consumer_type, buffer))
return false;
@@ -153,8 +151,7 @@ bool DataFetcherSharedMemoryBase::StopFetchingDeviceData(
polling_thread_->message_loop()->PostTask(
FROM_HERE,
base::Bind(&PollingThread::RemoveConsumer,
- base::Unretained(polling_thread_.get()),
- consumer_type));
+ base::Unretained(polling_thread_.get()), consumer_type));
} else {
if (!Stop(consumer_type))
return false;
@@ -173,7 +170,8 @@ void DataFetcherSharedMemoryBase::Shutdown() {
base::SharedMemoryHandle
DataFetcherSharedMemoryBase::GetSharedMemoryHandleForProcess(
- ConsumerType consumer_type, base::ProcessHandle process) {
+ ConsumerType consumer_type,
+ base::ProcessHandle process) {
SharedMemoryMap::const_iterator it = shared_memory_map_.find(consumer_type);
if (it == shared_memory_map_.end())
return base::SharedMemory::NULLHandle();
@@ -191,8 +189,8 @@ bool DataFetcherSharedMemoryBase::InitAndStartPollingThreadIfNecessary() {
new PollingThread("Inertial Device Sensor poller", this));
if (!polling_thread_->Start()) {
- LOG(ERROR) << "Failed to start inertial sensor data polling thread";
- return false;
+ LOG(ERROR) << "Failed to start inertial sensor data polling thread";
+ return false;
}
return true;
}
@@ -201,8 +199,8 @@ void DataFetcherSharedMemoryBase::Fetch(unsigned consumer_bitmask) {
NOTIMPLEMENTED();
}
-DataFetcherSharedMemoryBase::FetcherType
-DataFetcherSharedMemoryBase::GetType() const {
+DataFetcherSharedMemoryBase::FetcherType DataFetcherSharedMemoryBase::GetType()
+ const {
return FETCHER_TYPE_DEFAULT;
}
@@ -248,4 +246,4 @@ bool DataFetcherSharedMemoryBase::IsPollingTimerRunningForTesting() const {
return polling_thread_ ? polling_thread_->IsTimerRunning() : false;
}
-} // namespace content
+} // namespace device

Powered by Google App Engine
This is Rietveld 408576698