OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_sensors/data_fetcher_shared_memory_base.h" | 5 #include "content/browser/device_sensors/data_fetcher_shared_memory_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 NOTREACHED(); | 29 NOTREACHED(); |
30 } | 30 } |
31 return 0; | 31 return 0; |
32 } | 32 } |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 class DataFetcherSharedMemoryBase::PollingThread : public base::Thread { | 36 class DataFetcherSharedMemoryBase::PollingThread : public base::Thread { |
37 public: | 37 public: |
38 PollingThread(const char* name, DataFetcherSharedMemoryBase* fetcher); | 38 PollingThread(const char* name, DataFetcherSharedMemoryBase* fetcher); |
39 virtual ~PollingThread(); | 39 ~PollingThread() override; |
40 | 40 |
41 void AddConsumer(ConsumerType consumer_type, void* buffer); | 41 void AddConsumer(ConsumerType consumer_type, void* buffer); |
42 void RemoveConsumer(ConsumerType consumer_type); | 42 void RemoveConsumer(ConsumerType consumer_type); |
43 | 43 |
44 unsigned GetConsumersBitmask() const { return consumers_bitmask_; } | 44 unsigned GetConsumersBitmask() const { return consumers_bitmask_; } |
45 bool IsTimerRunning() const { return timer_ ? timer_->IsRunning() : false; } | 45 bool IsTimerRunning() const { return timer_ ? timer_->IsRunning() : false; } |
46 | 46 |
47 private: | 47 private: |
48 void DoPoll(); | 48 void DoPoll(); |
49 | 49 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 base::MessageLoop* DataFetcherSharedMemoryBase::GetPollingMessageLoop() const { | 243 base::MessageLoop* DataFetcherSharedMemoryBase::GetPollingMessageLoop() const { |
244 return polling_thread_ ? polling_thread_->message_loop() : NULL; | 244 return polling_thread_ ? polling_thread_->message_loop() : NULL; |
245 } | 245 } |
246 | 246 |
247 bool DataFetcherSharedMemoryBase::IsPollingTimerRunningForTesting() const { | 247 bool DataFetcherSharedMemoryBase::IsPollingTimerRunningForTesting() const { |
248 return polling_thread_ ? polling_thread_->IsTimerRunning() : false; | 248 return polling_thread_ ? polling_thread_->IsTimerRunning() : false; |
249 } | 249 } |
250 | 250 |
251 } // namespace content | 251 } // namespace content |
OLD | NEW |