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

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

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 years, 2 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
11 #include "base/bit_cast.h" 11 #include "base/bit_cast.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
14 #include "base/metrics/sparse_histogram.h" 15 #include "base/metrics/sparse_histogram.h"
15 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
16 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
18 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
19 #include "components/sync/base/cancelation_signal.h" 20 #include "components/sync/base/cancelation_signal.h"
20 #include "net/base/load_flags.h" 21 #include "net/base/load_flags.h"
21 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
22 #include "net/http/http_cache.h" 23 #include "net/http/http_cache.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 DCHECK(network_task_runner_->BelongsToCurrentThread()); 217 DCHECK(network_task_runner_->BelongsToCurrentThread());
217 218
218 base::AutoLock lock(fetch_state_lock_); 219 base::AutoLock lock(fetch_state_lock_);
219 DCHECK(!fetch_state_.request_completed); 220 DCHECK(!fetch_state_.request_completed);
220 if (fetch_state_.aborted) 221 if (fetch_state_.aborted)
221 return; 222 return;
222 223
223 // Start the timer on the network thread (the same thread progress is made 224 // Start the timer on the network thread (the same thread progress is made
224 // on, and on which the url fetcher lives). 225 // on, and on which the url fetcher lives).
225 DCHECK(!fetch_state_.http_request_timeout_timer.get()); 226 DCHECK(!fetch_state_.http_request_timeout_timer.get());
226 fetch_state_.http_request_timeout_timer.reset(new base::Timer(false, false)); 227 fetch_state_.http_request_timeout_timer =
228 base::MakeUnique<base::Timer>(false, false);
227 fetch_state_.http_request_timeout_timer->Start( 229 fetch_state_.http_request_timeout_timer->Start(
228 FROM_HERE, base::TimeDelta::FromSeconds(kMaxHttpRequestTimeSeconds), 230 FROM_HERE, base::TimeDelta::FromSeconds(kMaxHttpRequestTimeSeconds),
229 base::Bind(&HttpBridge::OnURLFetchTimedOut, this)); 231 base::Bind(&HttpBridge::OnURLFetchTimedOut, this));
230 232
231 DCHECK(request_context_getter_.get()); 233 DCHECK(request_context_getter_.get());
232 fetch_state_.start_time = base::Time::Now(); 234 fetch_state_.start_time = base::Time::Now();
233 fetch_state_.url_poster = 235 fetch_state_.url_poster =
234 net::URLFetcher::Create(url_for_request_, net::URLFetcher::POST, this) 236 net::URLFetcher::Create(url_for_request_, net::URLFetcher::POST, this)
235 .release(); 237 .release();
236 if (!bind_to_tracker_callback_.is_null()) 238 if (!bind_to_tracker_callback_.is_null())
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 int64_t sane_time_ms = 0; 437 int64_t sane_time_ms = 0;
436 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { 438 if (base::StringToInt64(sane_time_str, &sane_time_ms)) {
437 network_time_update_callback_.Run( 439 network_time_update_callback_.Run(
438 base::Time::FromJsTime(sane_time_ms), 440 base::Time::FromJsTime(sane_time_ms),
439 base::TimeDelta::FromMilliseconds(1), 441 base::TimeDelta::FromMilliseconds(1),
440 fetch_state_.end_time - fetch_state_.start_time); 442 fetch_state_.end_time - fetch_state_.start_time);
441 } 443 }
442 } 444 }
443 445
444 } // namespace syncer 446 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine/fake_sync_manager.cc ('k') | components/sync/engine_impl/apply_control_data_updates_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698