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

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

Issue 375023002: sync: Support nudges from non-blocking sync types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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_SYNC_MANAGER_H_ 5 #ifndef SYNC_INTERNAL_API_SYNC_MANAGER_H_
6 #define SYNC_INTERNAL_API_SYNC_MANAGER_H_ 6 #define SYNC_INTERNAL_API_SYNC_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "net/base/network_change_notifier.h" 11 #include "net/base/network_change_notifier.h"
12 #include "sync/base/sync_export.h" 12 #include "sync/base/sync_export.h"
13 #include "sync/engine/all_status.h" 13 #include "sync/engine/all_status.h"
14 #include "sync/engine/net/server_connection_manager.h" 14 #include "sync/engine/net/server_connection_manager.h"
15 #include "sync/engine/nudge_handler.h"
15 #include "sync/engine/sync_engine_event_listener.h" 16 #include "sync/engine/sync_engine_event_listener.h"
16 #include "sync/internal_api/change_reorder_buffer.h" 17 #include "sync/internal_api/change_reorder_buffer.h"
17 #include "sync/internal_api/debug_info_event_listener.h" 18 #include "sync/internal_api/debug_info_event_listener.h"
18 #include "sync/internal_api/js_mutation_event_observer.h" 19 #include "sync/internal_api/js_mutation_event_observer.h"
19 #include "sync/internal_api/js_sync_encryption_handler_observer.h" 20 #include "sync/internal_api/js_sync_encryption_handler_observer.h"
20 #include "sync/internal_api/js_sync_manager_observer.h" 21 #include "sync/internal_api/js_sync_manager_observer.h"
21 #include "sync/internal_api/protocol_event_buffer.h" 22 #include "sync/internal_api/protocol_event_buffer.h"
22 #include "sync/internal_api/public/base/invalidator_state.h" 23 #include "sync/internal_api/public/base/invalidator_state.h"
23 #include "sync/internal_api/public/sync_context_proxy.h" 24 #include "sync/internal_api/public/sync_context_proxy.h"
24 #include "sync/internal_api/public/sync_manager.h" 25 #include "sync/internal_api/public/sync_manager.h"
(...skipping 19 matching lines...) Expand all
44 } 45 }
45 46
46 // SyncManager encapsulates syncable::Directory and serves as the parent of all 47 // SyncManager encapsulates syncable::Directory and serves as the parent of all
47 // other objects in the sync API. If multiple threads interact with the same 48 // other objects in the sync API. If multiple threads interact with the same
48 // local sync repository (i.e. the same sqlite database), they should share a 49 // local sync repository (i.e. the same sqlite database), they should share a
49 // single SyncManager instance. The caller should typically create one 50 // single SyncManager instance. The caller should typically create one
50 // SyncManager for the lifetime of a user session. 51 // SyncManager for the lifetime of a user session.
51 // 52 //
52 // Unless stated otherwise, all methods of SyncManager should be called on the 53 // Unless stated otherwise, all methods of SyncManager should be called on the
53 // same thread. 54 // same thread.
54 class SYNC_EXPORT_PRIVATE SyncManagerImpl : 55 class SYNC_EXPORT_PRIVATE SyncManagerImpl
55 public SyncManager, 56 : public SyncManager,
56 public net::NetworkChangeNotifier::IPAddressObserver, 57 public net::NetworkChangeNotifier::IPAddressObserver,
57 public net::NetworkChangeNotifier::ConnectionTypeObserver, 58 public net::NetworkChangeNotifier::ConnectionTypeObserver,
58 public JsBackend, 59 public JsBackend,
59 public SyncEngineEventListener, 60 public SyncEngineEventListener,
60 public ServerConnectionEventListener, 61 public ServerConnectionEventListener,
61 public syncable::DirectoryChangeDelegate, 62 public syncable::DirectoryChangeDelegate,
62 public SyncEncryptionHandler::Observer { 63 public SyncEncryptionHandler::Observer,
64 public NudgeHandler {
63 public: 65 public:
64 // Create an uninitialized SyncManager. Callers must Init() before using. 66 // Create an uninitialized SyncManager. Callers must Init() before using.
65 explicit SyncManagerImpl(const std::string& name); 67 explicit SyncManagerImpl(const std::string& name);
66 virtual ~SyncManagerImpl(); 68 virtual ~SyncManagerImpl();
67 69
68 // SyncManager implementation. 70 // SyncManager implementation.
69 virtual void Init( 71 virtual void Init(
70 const base::FilePath& database_location, 72 const base::FilePath& database_location,
71 const WeakHandle<JsEventHandler>& event_handler, 73 const WeakHandle<JsEventHandler>& event_handler,
72 const std::string& sync_server_and_path, 74 const std::string& sync_server_and_path,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Handle explicit requests to fetch updates for the given types. 189 // Handle explicit requests to fetch updates for the given types.
188 virtual void RefreshTypes(ModelTypeSet types) OVERRIDE; 190 virtual void RefreshTypes(ModelTypeSet types) OVERRIDE;
189 191
190 // These OnYYYChanged() methods are only called by our NetworkChangeNotifier. 192 // These OnYYYChanged() methods are only called by our NetworkChangeNotifier.
191 // Called when IP address of primary interface changes. 193 // Called when IP address of primary interface changes.
192 virtual void OnIPAddressChanged() OVERRIDE; 194 virtual void OnIPAddressChanged() OVERRIDE;
193 // Called when the connection type of the system has changed. 195 // Called when the connection type of the system has changed.
194 virtual void OnConnectionTypeChanged( 196 virtual void OnConnectionTypeChanged(
195 net::NetworkChangeNotifier::ConnectionType) OVERRIDE; 197 net::NetworkChangeNotifier::ConnectionType) OVERRIDE;
196 198
199 // NudgeHandler implementation.
200 virtual void NudgeForInitialDownload(syncer::ModelType type) OVERRIDE;
201 virtual void NudgeForCommit(syncer::ModelType type) OVERRIDE;
202 virtual void NudgeForRefresh(syncer::ModelType type) OVERRIDE;
203
197 const SyncScheduler* scheduler() const; 204 const SyncScheduler* scheduler() const;
198 205
199 bool GetHasInvalidAuthTokenForTest() const; 206 bool GetHasInvalidAuthTokenForTest() const;
200 207
201 protected: 208 protected:
202 // Helper functions. Virtual for testing. 209 // Helper functions. Virtual for testing.
203 virtual void NotifyInitializationSuccess(); 210 virtual void NotifyInitializationSuccess();
204 virtual void NotifyInitializationFailure(); 211 virtual void NotifyInitializationFailure();
205 212
206 private: 213 private:
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; 371 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_;
365 372
366 base::WeakPtrFactory<SyncManagerImpl> weak_ptr_factory_; 373 base::WeakPtrFactory<SyncManagerImpl> weak_ptr_factory_;
367 374
368 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); 375 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl);
369 }; 376 };
370 377
371 } // namespace syncer 378 } // namespace syncer
372 379
373 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ 380 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_
OLDNEW
« no previous file with comments | « sync/internal_api/sync_context_proxy_impl_unittest.cc ('k') | sync/internal_api/sync_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698