| Index: content/browser/device_orientation/data_fetcher_impl_win.cc
|
| diff --git a/content/browser/device_orientation/data_fetcher_impl_win.cc b/content/browser/device_orientation/data_fetcher_impl_win.cc
|
| index d08ed446ad623f4c8e577cc7fd97fdf01f14f559..6debc99904c4c5c37eb8e62a4f6da8f77315c0b1 100644
|
| --- a/content/browser/device_orientation/data_fetcher_impl_win.cc
|
| +++ b/content/browser/device_orientation/data_fetcher_impl_win.cc
|
| @@ -101,25 +101,34 @@ class DataFetcherImplWin::SensorEventSink : public ISensorEvents,
|
| DISALLOW_COPY_AND_ASSIGN(SensorEventSink);
|
| };
|
|
|
| +DataFetcherImplWin* DataFetcherImplWin::instance() {
|
| + CR_DEFINE_STATIC_LOCAL(DataFetcherImplWin, s_data_fetcher, ());
|
| + return &s_data_fetcher;
|
| +}
|
| +
|
| // Create a DataFetcherImplWin object and return NULL if no valid sensor found.
|
| // static
|
| DataFetcher* DataFetcherImplWin::Create() {
|
| - scoped_ptr<DataFetcherImplWin> fetcher(new DataFetcherImplWin);
|
| + DataFetcherImplWin* fetcher = DataFetcherImplWin::instance();
|
| if (fetcher->Initialize())
|
| - return fetcher.release();
|
| + return fetcher;
|
|
|
| LOG(ERROR) << "DataFetcherImplWin::Initialize failed!";
|
| return NULL;
|
| }
|
|
|
| DataFetcherImplWin::~DataFetcherImplWin() {
|
| - if (sensor_)
|
| - sensor_->SetEventSink(NULL);
|
| + Stop();
|
| }
|
|
|
| DataFetcherImplWin::DataFetcherImplWin() {
|
| }
|
|
|
| +void DataFetcherImplWin::Stop() {
|
| + if (sensor_)
|
| + sensor_->SetEventSink(NULL);
|
| +}
|
| +
|
| void DataFetcherImplWin::OnOrientationData(Orientation* orientation) {
|
| // This method is called on Windows sensor thread.
|
| base::AutoLock autolock(next_orientation_lock_);
|
|
|