Index: sync/internal_api/public/http_bridge.h |
diff --git a/sync/internal_api/public/http_bridge.h b/sync/internal_api/public/http_bridge.h |
index cbee77112f86bdc32b7204cac51a22796debeab9..c8a21b97157a19dc4d63fe939ee5ef78fdabf7ea 100644 |
--- a/sync/internal_api/public/http_bridge.h |
+++ b/sync/internal_api/public/http_bridge.h |
@@ -19,6 +19,7 @@ |
#include "net/url_request/url_request_context.h" |
#include "net/url_request/url_request_context_getter.h" |
#include "sync/base/sync_export.h" |
+#include "sync/internal_api/public/base/cancelation_observer.h" |
#include "sync/internal_api/public/http_post_provider_factory.h" |
#include "sync/internal_api/public/http_post_provider_interface.h" |
#include "url/gurl.h" |
@@ -37,6 +38,8 @@ class URLFetcher; |
namespace syncer { |
+class CancelationSignal; |
+ |
// Callback for updating the network time. |
// Params: |
// const base::Time& network_time - the new network time. |
@@ -229,31 +232,44 @@ class SYNC_EXPORT_PRIVATE HttpBridge |
DISALLOW_COPY_AND_ASSIGN(HttpBridge); |
}; |
-class SYNC_EXPORT HttpBridgeFactory : public HttpPostProviderFactory { |
+class SYNC_EXPORT HttpBridgeFactory : public HttpPostProviderFactory, |
+ public CancelationObserver { |
public: |
HttpBridgeFactory( |
net::URLRequestContextGetter* baseline_context_getter, |
- const std::string& user_agent, |
- const NetworkTimeUpdateCallback& network_time_update_callback); |
+ const NetworkTimeUpdateCallback& network_time_update_callback, |
+ CancelationSignal* cancelation_signal); |
virtual ~HttpBridgeFactory(); |
// HttpPostProviderFactory: |
+ virtual void Init(const std::string& user_agent) OVERRIDE; |
virtual HttpPostProviderInterface* Create() OVERRIDE; |
virtual void Destroy(HttpPostProviderInterface* http) OVERRIDE; |
- virtual void Shutdown() OVERRIDE; |
+ |
+ // CancelationObserver implementation: |
+ virtual void OnStopRequested() OVERRIDE; |
private: |
- // Protects |request_context_getter_|. |
+ // Protects |request_context_getter_| and |baseline_request_context_getter_|. |
base::Lock context_getter_lock_; |
+ // This request context is the starting point for the request_context_getter_ |
+ // that we eventually use to make requests. During shutdown we must drop all |
+ // references to it before the ProfileSyncService's Shutdown() call is |
+ // complete. |
+ scoped_refptr<net::URLRequestContextGetter> baseline_request_context_getter_; |
+ |
// This request context is built on top of the baseline context and shares |
- // common components. It's mostly used on sync thread when creating |
- // connection but is released as soon as possible during shutdown. Protected |
- // by |context_getter_lock_|. |
+ // common components. Takes a reference to the |
+ // baseline_request_context_getter_. It's mostly used on sync thread when |
+ // creating connection but is released as soon as possible during shutdown. |
+ // Protected by |context_getter_lock_|. |
scoped_refptr<HttpBridge::RequestContextGetter> request_context_getter_; |
NetworkTimeUpdateCallback network_time_update_callback_; |
+ CancelationSignal* const cancelation_signal_; |
+ |
DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); |
}; |