Index: sync/internal_api/http_bridge.cc |
diff --git a/sync/internal_api/http_bridge.cc b/sync/internal_api/http_bridge.cc |
index 5827c9d77b50c0dbc9ba61a92152241c6b44cd21..0a0c4c2d07cccd2d8feac1ca32e399933ddffbbf 100644 |
--- a/sync/internal_api/http_bridge.cc |
+++ b/sync/internal_api/http_bridge.cc |
@@ -59,20 +59,15 @@ HttpBridge::RequestContextGetter::GetNetworkTaskRunner() const { |
HttpBridgeFactory::HttpBridgeFactory( |
net::URLRequestContextGetter* baseline_context_getter, |
- const NetworkTimeUpdateCallback& network_time_update_callback, |
- CancelationSignal* cancelation_signal) |
+ const NetworkTimeUpdateCallback& network_time_update_callback) |
: baseline_request_context_getter_(baseline_context_getter), |
network_time_update_callback_(network_time_update_callback), |
- cancelation_signal_(cancelation_signal) { |
- // Registration should never fail. This should happen on the UI thread during |
- // init. It would be impossible for a shutdown to have been requested at this |
- // point. |
- bool result = cancelation_signal_->TryRegisterHandler(this); |
- DCHECK(result); |
+ cancelation_signal_(NULL) { |
} |
HttpBridgeFactory::~HttpBridgeFactory() { |
- cancelation_signal_->UnregisterHandler(this); |
+ if (cancelation_signal_ != NULL) |
+ cancelation_signal_->UnregisterHandler(this); |
} |
void HttpBridgeFactory::Init(const std::string& user_agent) { |
@@ -89,6 +84,17 @@ void HttpBridgeFactory::Init(const std::string& user_agent) { |
baseline_request_context_getter_, user_agent); |
} |
+void HttpBridgeFactory::RegisterCancelationSignal( |
+ CancelationSignal* cancelation_signal) { |
+ cancelation_signal_ = cancelation_signal; |
+ |
+ // Registration should never fail. This should happen on the UI thread during |
+ // init. It would be impossible for a shutdown to have been requested at this |
+ // point. |
+ bool result = cancelation_signal_->TryRegisterHandler(this); |
+ DCHECK(result); |
+} |
+ |
HttpPostProviderInterface* HttpBridgeFactory::Create() { |
base::AutoLock lock(context_getter_lock_); |