OLD | NEW |
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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 explicit SyncCore(ModelTypeRegistry* model_type_registry); | 29 explicit SyncCore(ModelTypeRegistry* model_type_registry); |
30 ~SyncCore(); | 30 ~SyncCore(); |
31 | 31 |
32 // Initializes the connection between the sync core and its delegate on the | 32 // Initializes the connection between the sync core and its delegate on the |
33 // sync client's thread. | 33 // sync client's thread. |
34 void ConnectSyncTypeToCore( | 34 void ConnectSyncTypeToCore( |
35 syncer::ModelType type, | 35 syncer::ModelType type, |
36 scoped_refptr<base::SequencedTaskRunner> datatype_task_runner, | 36 scoped_refptr<base::SequencedTaskRunner> datatype_task_runner, |
37 base::WeakPtr<NonBlockingTypeProcessor> sync_client); | 37 base::WeakPtr<NonBlockingTypeProcessor> sync_client); |
38 | 38 |
| 39 // Disconnects the syncer from the model and stops syncing the type. |
| 40 // |
| 41 // 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 |
| 43 // messages sent to that NonBlockingTypeProcessor will not be recived. |
| 44 // |
| 45 // 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 |
| 47 // abort any in-progress commit requests. |
| 48 void Disconnect(ModelType type); |
| 49 |
39 base::WeakPtr<SyncCore> AsWeakPtr(); | 50 base::WeakPtr<SyncCore> AsWeakPtr(); |
40 | 51 |
41 private: | 52 private: |
42 ModelTypeRegistry* model_type_registry_; | 53 ModelTypeRegistry* model_type_registry_; |
43 base::WeakPtrFactory<SyncCore> weak_ptr_factory_; | 54 base::WeakPtrFactory<SyncCore> weak_ptr_factory_; |
44 | 55 |
45 DISALLOW_COPY_AND_ASSIGN(SyncCore); | 56 DISALLOW_COPY_AND_ASSIGN(SyncCore); |
46 }; | 57 }; |
47 | 58 |
48 } // namespace syncer | 59 } // namespace syncer |
49 | 60 |
50 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_CORE_H_ | 61 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_CORE_H_ |
51 | 62 |
OLD | NEW |