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

Side by Side Diff: components/sync/engine/net/http_bridge.cc

Issue 2837863004: Use base::OneShotTimer instead of base::Timer(false, false)
Patch Set: rebase Created 3 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "components/sync/engine/net/http_bridge.h" 5 #include "components/sync/engine/net/http_bridge.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 base::AutoLock lock(fetch_state_lock_); 222 base::AutoLock lock(fetch_state_lock_);
223 DCHECK(!fetch_state_.request_completed); 223 DCHECK(!fetch_state_.request_completed);
224 if (fetch_state_.aborted) 224 if (fetch_state_.aborted)
225 return; 225 return;
226 226
227 // Start the timer on the network thread (the same thread progress is made 227 // Start the timer on the network thread (the same thread progress is made
228 // on, and on which the url fetcher lives). 228 // on, and on which the url fetcher lives).
229 DCHECK(!fetch_state_.http_request_timeout_timer.get()); 229 DCHECK(!fetch_state_.http_request_timeout_timer.get());
230 fetch_state_.http_request_timeout_timer = 230 fetch_state_.http_request_timeout_timer =
231 base::MakeUnique<base::Timer>(false, false); 231 base::MakeUnique<base::OneShotTimer>();
232 fetch_state_.http_request_timeout_timer->Start( 232 fetch_state_.http_request_timeout_timer->Start(
233 FROM_HERE, base::TimeDelta::FromSeconds(kMaxHttpRequestTimeSeconds), 233 FROM_HERE, base::TimeDelta::FromSeconds(kMaxHttpRequestTimeSeconds),
234 base::Bind(&HttpBridge::OnURLFetchTimedOut, this)); 234 base::Bind(&HttpBridge::OnURLFetchTimedOut, this));
235 235
236 DCHECK(request_context_getter_.get()); 236 DCHECK(request_context_getter_.get());
237 fetch_state_.start_time = base::Time::Now(); 237 fetch_state_.start_time = base::Time::Now();
238 net::NetworkTrafficAnnotationTag traffic_annotation = 238 net::NetworkTrafficAnnotationTag traffic_annotation =
239 net::DefineNetworkTrafficAnnotation("sync_http_bridge", R"( 239 net::DefineNetworkTrafficAnnotation("sync_http_bridge", R"(
240 semantics { 240 semantics {
241 sender: "Chrome Sync" 241 sender: "Chrome Sync"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 int64_t sane_time_ms = 0; 471 int64_t sane_time_ms = 0;
472 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { 472 if (base::StringToInt64(sane_time_str, &sane_time_ms)) {
473 network_time_update_callback_.Run( 473 network_time_update_callback_.Run(
474 base::Time::FromJsTime(sane_time_ms), 474 base::Time::FromJsTime(sane_time_ms),
475 base::TimeDelta::FromMilliseconds(1), 475 base::TimeDelta::FromMilliseconds(1),
476 fetch_state_.end_time - fetch_state_.start_time); 476 fetch_state_.end_time - fetch_state_.start_time);
477 } 477 }
478 } 478 }
479 479
480 } // namespace syncer 480 } // namespace syncer
OLDNEW
« no previous file with comments | « components/error_page/renderer/net_error_helper_core.cc ('k') | components/sync/model_impl/attachments/task_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698