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

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

Issue 280983002: Implement sync in the NonBlockingTypeProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gyp error and some tests Created 6 years, 7 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
« no previous file with comments | « sync/internal_api/public/test/null_sync_core_proxy.h ('k') | sync/internal_api/sync_core.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_PUBLIC_SYNC_CORE_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_SYNC_CORE_H_
6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_CORE_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_CORE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
11 #include "sync/base/sync_export.h" 11 #include "sync/base/sync_export.h"
12 #include "sync/internal_api/public/base/model_type.h" 12 #include "sync/internal_api/public/base/model_type.h"
13 13
14 namespace syncer { 14 namespace syncer {
15 15
16 class ModelTypeRegistry; 16 class ModelTypeRegistry;
17 class NonBlockingTypeProcessor; 17 class NonBlockingTypeProcessor;
18 struct DataTypeState;
18 19
19 // An interface of the core parts of sync. 20 // An interface of the core parts of sync.
20 // 21 //
21 // In theory, this is the component that provides off-thread sync types with 22 // In theory, this is the component that provides off-thread sync types with
22 // functionality to schedule and execute communication with the sync server. In 23 // functionality to schedule and execute communication with the sync server. In
23 // practice, this class delegates most of the responsibilty of implemeting this 24 // practice, this class delegates most of the responsibilty of implemeting this
24 // functionality to other classes, and most of the interface is exposed not 25 // functionality to other classes, and most of the interface is exposed not
25 // directly here but instead through a per-ModelType class that this class helps 26 // directly here but instead through a per-ModelType class that this class helps
26 // instantiate. 27 // instantiate.
27 class SYNC_EXPORT_PRIVATE SyncCore { 28 class SYNC_EXPORT_PRIVATE SyncCore {
28 public: 29 public:
29 explicit SyncCore(ModelTypeRegistry* model_type_registry); 30 explicit SyncCore(ModelTypeRegistry* model_type_registry);
30 ~SyncCore(); 31 ~SyncCore();
31 32
32 // Initializes the connection between the sync core and its delegate on the 33 // Initializes the connection between the sync core and its delegate on the
33 // sync client's thread. 34 // sync client's thread.
34 void ConnectSyncTypeToCore( 35 void ConnectSyncTypeToCore(
35 syncer::ModelType type, 36 syncer::ModelType type,
36 scoped_refptr<base::SequencedTaskRunner> datatype_task_runner, 37 const DataTypeState& data_type_state,
37 base::WeakPtr<NonBlockingTypeProcessor> sync_client); 38 scoped_refptr<base::SequencedTaskRunner> datatype_task_runner,
39 base::WeakPtr<NonBlockingTypeProcessor> sync_client);
38 40
39 // Disconnects the syncer from the model and stops syncing the type. 41 // Disconnects the syncer from the model and stops syncing the type.
40 // 42 //
41 // By the time this is called, the model thread should have already 43 // By the time this is called, the model thread should have already
42 // invalidated the WeakPtr it sent to us in the connect request. Any 44 // invalidated the WeakPtr it sent to us in the connect request. Any
43 // messages sent to that NonBlockingTypeProcessor will not be recived. 45 // messages sent to that NonBlockingTypeProcessor will not be recived.
44 // 46 //
45 // This is the sync thread's chance to clear state associated with the type. 47 // This is the sync thread's chance to clear state associated with the type.
46 // It also causes the syncer to stop requesting updates for this type, and to 48 // It also causes the syncer to stop requesting updates for this type, and to
47 // abort any in-progress commit requests. 49 // abort any in-progress commit requests.
48 void Disconnect(ModelType type); 50 void Disconnect(ModelType type);
49 51
50 base::WeakPtr<SyncCore> AsWeakPtr(); 52 base::WeakPtr<SyncCore> AsWeakPtr();
51 53
52 private: 54 private:
53 ModelTypeRegistry* model_type_registry_; 55 ModelTypeRegistry* model_type_registry_;
54 base::WeakPtrFactory<SyncCore> weak_ptr_factory_; 56 base::WeakPtrFactory<SyncCore> weak_ptr_factory_;
55 57
56 DISALLOW_COPY_AND_ASSIGN(SyncCore); 58 DISALLOW_COPY_AND_ASSIGN(SyncCore);
57 }; 59 };
58 60
59 } // namespace syncer 61 } // namespace syncer
60 62
61 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_CORE_H_ 63 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_CORE_H_
62 64
OLDNEW
« no previous file with comments | « sync/internal_api/public/test/null_sync_core_proxy.h ('k') | sync/internal_api/sync_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698