OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/provider_impl.h" | 5 #include "content/browser/device_orientation/provider_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 void DeleteThread(base::Thread* thread) { | 18 void DeleteThread(base::Thread* thread) { |
19 thread->Stop(); | 19 thread->Stop(); |
20 delete thread; | 20 delete thread; |
21 } | 21 } |
22 | 22 |
23 } | 23 } |
24 | 24 |
25 namespace device_orientation { | 25 namespace content { |
26 | 26 |
27 class ProviderImpl::PollingThread : public base::Thread { | 27 class ProviderImpl::PollingThread : public base::Thread { |
28 public: | 28 public: |
29 PollingThread(const char* name, | 29 PollingThread(const char* name, |
30 base::WeakPtr<ProviderImpl> provider, | 30 base::WeakPtr<ProviderImpl> provider, |
31 MessageLoop* creator_loop); | 31 MessageLoop* creator_loop); |
32 virtual ~PollingThread(); | 32 virtual ~PollingThread(); |
33 | 33 |
34 // Method for creating a DataFetcher and starting the polling, if the fetcher | 34 // Method for creating a DataFetcher and starting the polling, if the fetcher |
35 // can provide this type of data. | 35 // can provide this type of data. |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 if ((*current)->device_data_type() == device_data_type) | 284 if ((*current)->device_data_type() == device_data_type) |
285 observers_.erase(current); | 285 observers_.erase(current); |
286 } | 286 } |
287 | 287 |
288 if (observers_.empty()) | 288 if (observers_.empty()) |
289 Stop(); | 289 Stop(); |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 | 293 |
294 } // namespace device_orientation | 294 } // namespace content |
OLD | NEW |