OLD | NEW |
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 "sync/internal_api/public/http_bridge.h" | 5 #include "sync/internal_api/public/http_bridge.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/profiler/scoped_profile.h" | 8 #include "base/profiler/scoped_tracker.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 #include "net/cookies/cookie_monster.h" | 12 #include "net/cookies/cookie_monster.h" |
13 #include "net/http/http_cache.h" | 13 #include "net/http/http_cache.h" |
14 #include "net/http/http_network_layer.h" | 14 #include "net/http/http_network_layer.h" |
15 #include "net/http/http_response_headers.h" | 15 #include "net/http/http_response_headers.h" |
16 #include "net/url_request/static_http_user_agent_settings.h" | 16 #include "net/url_request/static_http_user_agent_settings.h" |
17 #include "net/url_request/url_fetcher.h" | 17 #include "net/url_request/url_fetcher.h" |
18 #include "net/url_request/url_request_context.h" | 18 #include "net/url_request/url_request_context.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 fetch_state_.error_code = net::ERR_ABORTED; | 338 fetch_state_.error_code = net::ERR_ABORTED; |
339 http_post_completed_.Signal(); | 339 http_post_completed_.Signal(); |
340 } | 340 } |
341 | 341 |
342 void HttpBridge::DestroyURLFetcherOnIOThread(net::URLFetcher* fetcher) { | 342 void HttpBridge::DestroyURLFetcherOnIOThread(net::URLFetcher* fetcher) { |
343 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 343 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
344 delete fetcher; | 344 delete fetcher; |
345 } | 345 } |
346 | 346 |
347 void HttpBridge::OnURLFetchComplete(const net::URLFetcher* source) { | 347 void HttpBridge::OnURLFetchComplete(const net::URLFetcher* source) { |
348 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. | 348 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422577 is fixed. |
349 tracked_objects::ScopedProfile tracking_profile( | 349 tracked_objects::ScopedTracker tracking_profile( |
350 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 350 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
351 "422577 HttpBridge::OnURLFetchComplete")); | 351 "422577 HttpBridge::OnURLFetchComplete")); |
352 | 352 |
353 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 353 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
354 base::AutoLock lock(fetch_state_lock_); | 354 base::AutoLock lock(fetch_state_lock_); |
355 if (fetch_state_.aborted) | 355 if (fetch_state_.aborted) |
356 return; | 356 return; |
357 | 357 |
358 fetch_state_.end_time = base::Time::Now(); | 358 fetch_state_.end_time = base::Time::Now(); |
359 fetch_state_.request_completed = true; | 359 fetch_state_.request_completed = true; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 int64 sane_time_ms = 0; | 401 int64 sane_time_ms = 0; |
402 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { | 402 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { |
403 network_time_update_callback_.Run( | 403 network_time_update_callback_.Run( |
404 base::Time::FromJsTime(sane_time_ms), | 404 base::Time::FromJsTime(sane_time_ms), |
405 base::TimeDelta::FromMilliseconds(1), | 405 base::TimeDelta::FromMilliseconds(1), |
406 fetch_state_.end_time - fetch_state_.start_time); | 406 fetch_state_.end_time - fetch_state_.start_time); |
407 } | 407 } |
408 } | 408 } |
409 | 409 |
410 } // namespace syncer | 410 } // namespace syncer |
OLD | NEW |