Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: content/browser/device_sensors/data_fetcher_shared_memory_base.cc

Issue 1428533003: Fix crash in device_sensors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 this, &PollingThread::DoPoll); 84 this, &PollingThread::DoPoll);
85 } 85 }
86 } 86 }
87 87
88 void DataFetcherSharedMemoryBase::PollingThread::RemoveConsumer( 88 void DataFetcherSharedMemoryBase::PollingThread::RemoveConsumer(
89 ConsumerType consumer_type) { 89 ConsumerType consumer_type) {
90 DCHECK(fetcher_); 90 DCHECK(fetcher_);
91 if (!fetcher_->Stop(consumer_type)) 91 if (!fetcher_->Stop(consumer_type))
92 return; 92 return;
93 93
94 consumers_bitmask_ ^= consumer_type; 94 consumers_bitmask_ &= ~consumer_type;
95 95
96 if (!consumers_bitmask_) 96 if (!consumers_bitmask_)
97 timer_.reset(); // will also stop the timer. 97 timer_.reset(); // will also stop the timer.
98 } 98 }
99 99
100 void DataFetcherSharedMemoryBase::PollingThread::DoPoll() { 100 void DataFetcherSharedMemoryBase::PollingThread::DoPoll() {
101 DCHECK(fetcher_); 101 DCHECK(fetcher_);
102 DCHECK(consumers_bitmask_); 102 DCHECK(consumers_bitmask_);
103 fetcher_->Fetch(consumers_bitmask_); 103 fetcher_->Fetch(consumers_bitmask_);
104 } 104 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 base::MessageLoop* DataFetcherSharedMemoryBase::GetPollingMessageLoop() const { 245 base::MessageLoop* DataFetcherSharedMemoryBase::GetPollingMessageLoop() const {
246 return polling_thread_ ? polling_thread_->message_loop() : nullptr; 246 return polling_thread_ ? polling_thread_->message_loop() : nullptr;
247 } 247 }
248 248
249 bool DataFetcherSharedMemoryBase::IsPollingTimerRunningForTesting() const { 249 bool DataFetcherSharedMemoryBase::IsPollingTimerRunningForTesting() const {
250 return polling_thread_ ? polling_thread_->IsTimerRunning() : false; 250 return polling_thread_ ? polling_thread_->IsTimerRunning() : false;
251 } 251 }
252 252
253 } // namespace content 253 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698