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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 if (!fetch_state_.url_poster) | 505 if (!fetch_state_.url_poster) |
506 return; | 506 return; |
507 | 507 |
508 LogTimeout(true); | 508 LogTimeout(true); |
509 DVLOG(1) << "Sync url fetch timed out. Canceling."; | 509 DVLOG(1) << "Sync url fetch timed out. Canceling."; |
510 | 510 |
511 fetch_state_.end_time = base::Time::Now(); | 511 fetch_state_.end_time = base::Time::Now(); |
512 fetch_state_.request_completed = true; | 512 fetch_state_.request_completed = true; |
513 fetch_state_.request_succeeded = false; | 513 fetch_state_.request_succeeded = false; |
514 fetch_state_.http_response_code = -1; | 514 fetch_state_.http_response_code = -1; |
515 fetch_state_.error_code = net::URLRequestStatus::FAILED; | 515 fetch_state_.error_code = net::ERR_TIMED_OUT; |
516 | 516 |
517 // This method is called by the timer, not the url fetcher implementation, | 517 // This method is called by the timer, not the url fetcher implementation, |
518 // so it's safe to delete the fetcher here. | 518 // so it's safe to delete the fetcher here. |
519 delete fetch_state_.url_poster; | 519 delete fetch_state_.url_poster; |
520 fetch_state_.url_poster = NULL; | 520 fetch_state_.url_poster = NULL; |
521 | 521 |
522 // Timer is smart enough to handle being deleted as part of the invoked task. | 522 // Timer is smart enough to handle being deleted as part of the invoked task. |
523 fetch_state_.http_request_timeout_timer.reset(); | 523 fetch_state_.http_request_timeout_timer.reset(); |
524 | 524 |
525 // Wake the blocked syncer thread in MakeSynchronousPost. | 525 // Wake the blocked syncer thread in MakeSynchronousPost. |
(...skipping 20 matching lines...) Expand all Loading... |
546 int64_t sane_time_ms = 0; | 546 int64_t sane_time_ms = 0; |
547 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { | 547 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { |
548 network_time_update_callback_.Run( | 548 network_time_update_callback_.Run( |
549 base::Time::FromJsTime(sane_time_ms), | 549 base::Time::FromJsTime(sane_time_ms), |
550 base::TimeDelta::FromMilliseconds(1), | 550 base::TimeDelta::FromMilliseconds(1), |
551 fetch_state_.end_time - fetch_state_.start_time); | 551 fetch_state_.end_time - fetch_state_.start_time); |
552 } | 552 } |
553 } | 553 } |
554 | 554 |
555 } // namespace syncer | 555 } // namespace syncer |
OLD | NEW |