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/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 return context_.get(); | 50 return context_.get(); |
51 } | 51 } |
52 | 52 |
53 scoped_refptr<base::SingleThreadTaskRunner> | 53 scoped_refptr<base::SingleThreadTaskRunner> |
54 HttpBridge::RequestContextGetter::GetNetworkTaskRunner() const { | 54 HttpBridge::RequestContextGetter::GetNetworkTaskRunner() const { |
55 return network_task_runner_; | 55 return network_task_runner_; |
56 } | 56 } |
57 | 57 |
58 HttpBridgeFactory::HttpBridgeFactory( | 58 HttpBridgeFactory::HttpBridgeFactory( |
59 net::URLRequestContextGetter* baseline_context_getter, | 59 const scoped_refptr<net::URLRequestContextGetter>& baseline_context_getter, |
60 const NetworkTimeUpdateCallback& network_time_update_callback, | 60 const NetworkTimeUpdateCallback& network_time_update_callback, |
61 CancelationSignal* cancelation_signal) | 61 CancelationSignal* cancelation_signal) |
62 : baseline_request_context_getter_(baseline_context_getter), | 62 : baseline_request_context_getter_(baseline_context_getter), |
63 network_time_update_callback_(network_time_update_callback), | 63 network_time_update_callback_(network_time_update_callback), |
64 cancelation_signal_(cancelation_signal) { | 64 cancelation_signal_(cancelation_signal) { |
65 // Registration should never fail. This should happen on the UI thread during | 65 // Registration should never fail. This should happen on the UI thread during |
66 // init. It would be impossible for a shutdown to have been requested at this | 66 // init. It would be impossible for a shutdown to have been requested at this |
67 // point. | 67 // point. |
68 bool result = cancelation_signal_->TryRegisterHandler(this); | 68 bool result = cancelation_signal_->TryRegisterHandler(this); |
69 DCHECK(result); | 69 DCHECK(result); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 int64 sane_time_ms = 0; | 395 int64 sane_time_ms = 0; |
396 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { | 396 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { |
397 network_time_update_callback_.Run( | 397 network_time_update_callback_.Run( |
398 base::Time::FromJsTime(sane_time_ms), | 398 base::Time::FromJsTime(sane_time_ms), |
399 base::TimeDelta::FromMilliseconds(1), | 399 base::TimeDelta::FromMilliseconds(1), |
400 fetch_state_.end_time - fetch_state_.start_time); | 400 fetch_state_.end_time - fetch_state_.start_time); |
401 } | 401 } |
402 } | 402 } |
403 | 403 |
404 } // namespace syncer | 404 } // namespace syncer |
OLD | NEW |