diff options
author | timvolodine@chromium.org <timvolodine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-23 23:51:03 +0000 |
---|---|---|
committer | timvolodine@chromium.org <timvolodine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-23 23:51:03 +0000 |
commit | 9894b097e289381cbf9663cfe56675b19f7330de (patch) | |
tree | b394d9769f9fe68571e1b608f2cd454f0a6a0219 /content | |
parent | e3da4e80d5b48a5319c4e412eaceec7df6e77cad (diff) | |
download | chromium_src-9894b097e289381cbf9663cfe56675b19f7330de.zip chromium_src-9894b097e289381cbf9663cfe56675b19f7330de.tar.gz chromium_src-9894b097e289381cbf9663cfe56675b19f7330de.tar.bz2 |
Fix the device orientation premature DeviceData deletion concurrency issue
BUG=175748
Review URL: https://chromiumcodereview.appspot.com/12702027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/device_orientation/provider_impl.cc | 9 | ||||
-rw-r--r-- | content/browser/device_orientation/provider_impl.h | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/content/browser/device_orientation/provider_impl.cc b/content/browser/device_orientation/provider_impl.cc index b566cb0..c490514 100644 --- a/content/browser/device_orientation/provider_impl.cc +++ b/content/browser/device_orientation/provider_impl.cc @@ -44,7 +44,7 @@ class ProviderImpl::PollingThread : public base::Thread { // Schedule a notification to the |provider_| which lives on a different // thread (|creator_loop_| is its message loop). - void ScheduleDoNotify(const DeviceData* device_data, + void ScheduleDoNotify(const scoped_refptr<const DeviceData>& device_data, DeviceData::Type device_data_type); enum { kDesiredSamplingIntervalMs = 100 }; @@ -113,7 +113,8 @@ void ProviderImpl::PollingThread::Initialize(DataFetcherFactory factory, } void ProviderImpl::PollingThread::ScheduleDoNotify( - const DeviceData* device_data, DeviceData::Type device_data_type) { + const scoped_refptr<const DeviceData>& device_data, + DeviceData::Type device_data_type) { DCHECK(MessageLoop::current() == message_loop()); creator_loop_->PostTask(FROM_HERE, @@ -259,12 +260,10 @@ void ProviderImpl::ScheduleInitializePollingThread( device_data_type)); } -void ProviderImpl::DoNotify(const DeviceData* device_data, +void ProviderImpl::DoNotify(const scoped_refptr<const DeviceData>& data, DeviceData::Type device_data_type) { DCHECK(MessageLoop::current() == creator_loop_); - scoped_refptr<const DeviceData> data(device_data); - // Update last notification of this type. last_notifications_map_[device_data_type] = data; diff --git a/content/browser/device_orientation/provider_impl.h b/content/browser/device_orientation/provider_impl.h index 02e2e88..6706f06 100644 --- a/content/browser/device_orientation/provider_impl.h +++ b/content/browser/device_orientation/provider_impl.h @@ -47,7 +47,7 @@ class ProviderImpl : public Provider { // Method for notifying observers of a data update. // Runs on the creator_thread_. - void DoNotify(const DeviceData* device_data, + void DoNotify(const scoped_refptr<const DeviceData>& data, DeviceData::Type device_data_type); static bool ShouldFireEvent(const DeviceData* old_data, |