Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: sync/internal_api/public/http_bridge.h

Issue 23717047: Retry: sync: Gracefully handle early shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renames Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..be49aa7bcb27a4d35909c641225057f242a87708 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 OnSignalReceived() 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);
};
« no previous file with comments | « sync/internal_api/public/base/cancelation_signal_unittest.cc ('k') | sync/internal_api/public/http_post_provider_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698