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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 void HttpBridgeFactory::Init(const std::string& user_agent) { | 76 void HttpBridgeFactory::Init(const std::string& user_agent) { |
77 base::AutoLock lock(context_getter_lock_); | 77 base::AutoLock lock(context_getter_lock_); |
78 | 78 |
79 if (!baseline_request_context_getter_.get()) { | 79 if (!baseline_request_context_getter_.get()) { |
80 // Uh oh. We've been aborted before we finished initializing. There's no | 80 // Uh oh. We've been aborted before we finished initializing. There's no |
81 // point in initializating further; let's just return right away. | 81 // point in initializating further; let's just return right away. |
82 return; | 82 return; |
83 } | 83 } |
84 | 84 |
85 request_context_getter_ = | 85 request_context_getter_ = new HttpBridge::RequestContextGetter( |
86 new HttpBridge::RequestContextGetter( | 86 baseline_request_context_getter_.get(), user_agent); |
87 baseline_request_context_getter_, user_agent); | |
88 } | 87 } |
89 | 88 |
90 HttpPostProviderInterface* HttpBridgeFactory::Create() { | 89 HttpPostProviderInterface* HttpBridgeFactory::Create() { |
91 base::AutoLock lock(context_getter_lock_); | 90 base::AutoLock lock(context_getter_lock_); |
92 | 91 |
93 // If we've been asked to shut down (something which may happen asynchronously | 92 // If we've been asked to shut down (something which may happen asynchronously |
94 // and at pretty much any time), then we won't have a request_context_getter_. | 93 // and at pretty much any time), then we won't have a request_context_getter_. |
95 // Some external mechanism must ensure that this function is not called after | 94 // Some external mechanism must ensure that this function is not called after |
96 // we've been asked to shut down. | 95 // we've been asked to shut down. |
97 CHECK(request_context_getter_.get()); | 96 CHECK(request_context_getter_.get()); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 int64 sane_time_ms = 0; | 395 int64 sane_time_ms = 0; |
397 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { | 396 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { |
398 network_time_update_callback_.Run( | 397 network_time_update_callback_.Run( |
399 base::Time::FromJsTime(sane_time_ms), | 398 base::Time::FromJsTime(sane_time_ms), |
400 base::TimeDelta::FromMilliseconds(1), | 399 base::TimeDelta::FromMilliseconds(1), |
401 fetch_state_.end_time - fetch_state_.start_time); | 400 fetch_state_.end_time - fetch_state_.start_time); |
402 } | 401 } |
403 } | 402 } |
404 | 403 |
405 } // namespace syncer | 404 } // namespace syncer |
OLD | NEW |