Index: content/browser/device_orientation/provider_impl.cc |
diff --git a/content/browser/device_orientation/provider_impl.cc b/content/browser/device_orientation/provider_impl.cc |
index 25e9bfd968769567b7a1d51b61e30e41634c15a9..b57819993d3eb352c7466c0e281fd66fc880b3ee 100644 |
--- a/content/browser/device_orientation/provider_impl.cc |
+++ b/content/browser/device_orientation/provider_impl.cc |
@@ -13,6 +13,12 @@ |
#include "base/threading/thread.h" |
#include "base/threading/worker_pool.h" |
+#if defined(OS_ANDROID) |
+#include "content/browser/device_orientation/data_fetcher_impl_android.h" |
+#elif defined(OS_WIN) |
+#include "content/browser/device_orientation/data_fetcher_impl_win.h" |
+#endif |
+ |
namespace { |
void DeleteThread(base::Thread* thread) { |
@@ -54,7 +60,8 @@ class ProviderImpl::PollingThread : public base::Thread { |
// Typically the I/O loop, but may be something else during testing. |
base::MessageLoop* creator_loop_; |
- scoped_ptr<DataFetcher> data_fetcher_; |
+ DataFetcher* data_fetcher_; |
+ |
std::map<DeviceData::Type, scoped_refptr<const DeviceData> > |
last_device_data_map_; |
std::set<DeviceData::Type> polling_data_types_; |
@@ -68,6 +75,12 @@ ProviderImpl::PollingThread::PollingThread(const char* name, |
: base::Thread(name), creator_loop_(creator_loop), provider_(provider) {} |
ProviderImpl::PollingThread::~PollingThread() { |
+#if defined(OS_ANDROID) |
bulach
2013/07/10 16:59:41
// TODO(timvolodine): Remove this platform depende
timvolodine
2013/07/11 14:31:34
N/A anymore.
Done.
|
+ static_cast<DataFetcherImplAndroid*>(data_fetcher_)->Stop( |
+ DeviceData::kTypeOrientation); |
+#elif defined(OS_WIN) |
+ static_cast<DataFetcherImplWin*>(data_fetcher_)->Stop(); |
+#endif |
Stop(); |
} |
@@ -85,13 +98,13 @@ void ProviderImpl::PollingThread::Initialize(DataFetcherFactory factory, |
// Try to use factory to create a fetcher that can provide this type of |
// data. If factory creates a fetcher that provides this type of data, |
// start polling. |
- scoped_ptr<DataFetcher> fetcher(factory()); |
+ DataFetcher* fetcher = factory(); |
bulach
2013/07/10 16:59:41
hmm... factory() normally means it'll create an ob
timvolodine
2013/07/11 14:31:34
Sure. I've refactored the code and added a new cla
|
if (fetcher) { |
scoped_refptr<const DeviceData> device_data(fetcher->GetDeviceData(type)); |
if (device_data.get() != NULL) { |
// Pass ownership of fetcher to provider_. |
bulach
2013/07/10 16:59:41
remove comment?
timvolodine
2013/07/11 14:31:34
N/A anymore.
Done.
|
- data_fetcher_.swap(fetcher); |
+ data_fetcher_ = fetcher; |
last_device_data_map_[type] = device_data; |
// Notify observers. |
@@ -158,7 +171,7 @@ void ProviderImpl::PollingThread::ScheduleDoPoll() { |
base::TimeDelta ProviderImpl::PollingThread::SamplingInterval() const { |
DCHECK(base::MessageLoop::current() == message_loop()); |
- DCHECK(data_fetcher_.get()); |
+ DCHECK(data_fetcher_); |
// TODO(erg): There used to be unused code here, that called a default |
// implementation on the DataFetcherInterface that was never defined. I'm |