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

Side by Side Diff: sync/internal_api/syncapi_server_connection_manager.h

Issue 23189021: sync: Gracefully handle very early shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Retry: sync non-blocking early shutdown 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ 5 #ifndef SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_
6 #define SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ 6 #define SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "sync/base/sync_export.h" 13 #include "sync/base/sync_export.h"
14 #include "sync/engine/net/server_connection_manager.h" 14 #include "sync/engine/net/server_connection_manager.h"
15 #include "sync/internal_api/public/base/cancelation_signal.h"
15 16
16 namespace syncer { 17 namespace syncer {
17 18
19 class ConnectionDisconnectHandle;
18 class HttpPostProviderFactory; 20 class HttpPostProviderFactory;
19 class HttpPostProviderInterface; 21 class HttpPostProviderInterface;
20 22
21 // This provides HTTP Post functionality through the interface provided 23 // This provides HTTP Post functionality through the interface provided
22 // to the sync API by the application hosting the syncer backend. 24 // to the sync API by the application hosting the syncer backend.
23 class SyncAPIBridgedConnection : public ServerConnectionManager::Connection { 25 class SyncAPIBridgedConnection : public ServerConnectionManager::Connection {
24 public: 26 public:
25 SyncAPIBridgedConnection(ServerConnectionManager* scm, 27 SyncAPIBridgedConnection(ServerConnectionManager* scm,
26 HttpPostProviderFactory* factory); 28 HttpPostProviderFactory* factory);
27 29
(...skipping 20 matching lines...) Expand all
48 // subclass so that we can override MakePost() to generate a POST object using 50 // subclass so that we can override MakePost() to generate a POST object using
49 // an instance of the HttpPostProviderFactory class. 51 // an instance of the HttpPostProviderFactory class.
50 class SYNC_EXPORT_PRIVATE SyncAPIServerConnectionManager 52 class SYNC_EXPORT_PRIVATE SyncAPIServerConnectionManager
51 : public ServerConnectionManager { 53 : public ServerConnectionManager {
52 public: 54 public:
53 // Takes ownership of factory. 55 // Takes ownership of factory.
54 SyncAPIServerConnectionManager(const std::string& server, 56 SyncAPIServerConnectionManager(const std::string& server,
55 int port, 57 int port,
56 bool use_ssl, 58 bool use_ssl,
57 bool use_oauth2_token, 59 bool use_oauth2_token,
58 HttpPostProviderFactory* factory); 60 HttpPostProviderFactory* factory,
61 CancelationSignal* cancelation_signal);
59 virtual ~SyncAPIServerConnectionManager(); 62 virtual ~SyncAPIServerConnectionManager();
60 63
61 // ServerConnectionManager overrides. 64 // ServerConnectionManager overrides.
62 virtual Connection* MakeConnection() OVERRIDE; 65 virtual scoped_ptr<Connection> MakeConnection() OVERRIDE;
63 66
64 private: 67 private:
68 FRIEND_TEST_ALL_PREFIXES(
69 SyncAPIServerConnectionManagerTest, VeryEarlyAbortPost);
65 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, EarlyAbortPost); 70 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, EarlyAbortPost);
66 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, AbortPost); 71 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, AbortPost);
67 72
68 // A factory creating concrete HttpPostProviders for use whenever we need to 73 // A factory creating concrete HttpPostProviders for use whenever we need to
69 // issue a POST to sync servers. 74 // issue a POST to sync servers.
70 scoped_ptr<HttpPostProviderFactory> post_provider_factory_; 75 scoped_ptr<HttpPostProviderFactory> post_provider_factory_;
71 76
72 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager); 77 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager);
73 }; 78 };
74 79
75 } // namespace syncer 80 } // namespace syncer
76 81
77 #endif // SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ 82 #endif // SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_
OLDNEW
« no previous file with comments | « sync/internal_api/sync_manager_impl_unittest.cc ('k') | sync/internal_api/syncapi_server_connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698