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

Side by Side Diff: content/browser/device_orientation/provider_impl.cc

Issue 9195028: Convert use of int ms to TimeDelta in files owned by bulach. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 11 months 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <cmath> 5 #include <cmath>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 ScheduleDoPoll(); 147 ScheduleDoPoll();
148 } 148 }
149 149
150 void ProviderImpl::ScheduleDoPoll() { 150 void ProviderImpl::ScheduleDoPoll() {
151 DCHECK(MessageLoop::current() == polling_thread_->message_loop()); 151 DCHECK(MessageLoop::current() == polling_thread_->message_loop());
152 152
153 MessageLoop* polling_loop = polling_thread_->message_loop(); 153 MessageLoop* polling_loop = polling_thread_->message_loop();
154 polling_loop->PostDelayedTask( 154 polling_loop->PostDelayedTask(
155 FROM_HERE, 155 FROM_HERE,
156 base::Bind(&ProviderImpl::DoPoll, weak_factory_.GetWeakPtr()), 156 base::Bind(&ProviderImpl::DoPoll, weak_factory_.GetWeakPtr()),
157 SamplingIntervalMs()); 157 SamplingInterval());
158 } 158 }
159 159
160 namespace { 160 namespace {
161 161
162 bool IsElementSignificantlyDifferent(bool can_provide_element1, 162 bool IsElementSignificantlyDifferent(bool can_provide_element1,
163 bool can_provide_element2, 163 bool can_provide_element2,
164 double element1, 164 double element1,
165 double element2) { 165 double element2) {
166 const double kThreshold = 0.1; 166 const double kThreshold = 0.1;
167 167
(...skipping 17 matching lines...) Expand all
185 IsElementSignificantlyDifferent(o1.can_provide_beta_, 185 IsElementSignificantlyDifferent(o1.can_provide_beta_,
186 o2.can_provide_beta_, 186 o2.can_provide_beta_,
187 o1.beta_, 187 o1.beta_,
188 o2.beta_) || 188 o2.beta_) ||
189 IsElementSignificantlyDifferent(o1.can_provide_gamma_, 189 IsElementSignificantlyDifferent(o1.can_provide_gamma_,
190 o2.can_provide_gamma_, 190 o2.can_provide_gamma_,
191 o1.gamma_, 191 o1.gamma_,
192 o2.gamma_); 192 o2.gamma_);
193 } 193 }
194 194
195 int ProviderImpl::SamplingIntervalMs() const { 195 base::TimeDelta ProviderImpl::SamplingInterval() const {
196 DCHECK(MessageLoop::current() == polling_thread_->message_loop()); 196 DCHECK(MessageLoop::current() == polling_thread_->message_loop());
197 DCHECK(data_fetcher_.get()); 197 DCHECK(data_fetcher_.get());
198 198
199 // TODO(erg): There used to be unused code here, that called a default 199 // TODO(erg): There used to be unused code here, that called a default
200 // implementation on the DataFetcherInterface that was never defined. I'm 200 // implementation on the DataFetcherInterface that was never defined. I'm
201 // removing unused methods from headers. 201 // removing unused methods from headers.
202 return kDesiredSamplingIntervalMs; 202 return base::TimeDelta::FromMilliseconds(kDesiredSamplingIntervalMs);
203 } 203 }
204 204
205 } // namespace device_orientation 205 } // namespace device_orientation
OLDNEW
« no previous file with comments | « content/browser/device_orientation/provider_impl.h ('k') | content/browser/geolocation/device_data_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698