OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
15 #include "chrome/browser/sync/api/sync_change_processor.h" | 15 #include "chrome/browser/sync/api/sync_change_processor.h" |
16 #include "chrome/browser/sync/api/sync_error.h" | 16 #include "chrome/browser/sync/api/sync_error.h" |
17 #include "chrome/browser/sync/engine/model_safe_worker.h" | 17 #include "chrome/browser/sync/engine/model_safe_worker.h" |
18 | 18 |
19 class ProfileSyncFactory; | 19 class ProfileSyncComponentsFactory; |
20 class ProfileSyncService; | 20 class ProfileSyncService; |
21 class SyncData; | 21 class SyncData; |
22 class SyncableService; | 22 class SyncableService; |
23 | 23 |
24 typedef std::vector<SyncData> SyncDataList; | 24 typedef std::vector<SyncData> SyncDataList; |
25 | 25 |
26 namespace browser_sync { | 26 namespace browser_sync { |
27 | 27 |
28 class GenericChangeProcessor; | 28 class GenericChangeProcessor; |
29 class UnrecoverableErrorHandler; | 29 class UnrecoverableErrorHandler; |
(...skipping 19 matching lines...) Expand all Loading... |
49 : public base::RefCountedThreadSafe<SharedChangeProcessor>, | 49 : public base::RefCountedThreadSafe<SharedChangeProcessor>, |
50 public base::ThreadChecker { | 50 public base::ThreadChecker { |
51 public: | 51 public: |
52 // Create an uninitialized SharedChangeProcessor (to be later connected). | 52 // Create an uninitialized SharedChangeProcessor (to be later connected). |
53 SharedChangeProcessor(); | 53 SharedChangeProcessor(); |
54 | 54 |
55 // Connect to the Syncer. Will create and hold a new GenericChangeProcessor. | 55 // Connect to the Syncer. Will create and hold a new GenericChangeProcessor. |
56 // Returns: true if successful, false if disconnected or |local_service| was | 56 // Returns: true if successful, false if disconnected or |local_service| was |
57 // NULL. | 57 // NULL. |
58 virtual bool Connect( | 58 virtual bool Connect( |
59 ProfileSyncFactory* sync_factory, | 59 ProfileSyncComponentsFactory* sync_factory, |
60 ProfileSyncService* sync_service, | 60 ProfileSyncService* sync_service, |
61 UnrecoverableErrorHandler* error_handler, | 61 UnrecoverableErrorHandler* error_handler, |
62 const base::WeakPtr<SyncableService>& local_service); | 62 const base::WeakPtr<SyncableService>& local_service); |
63 | 63 |
64 // Disconnects from the generic change processor. May be called from any | 64 // Disconnects from the generic change processor. May be called from any |
65 // thread. After this, all attempts to interact with the change processor by | 65 // thread. After this, all attempts to interact with the change processor by |
66 // |local_service_| are dropped and return errors. The syncer will be safe to | 66 // |local_service_| are dropped and return errors. The syncer will be safe to |
67 // shut down from the point of view of this datatype. | 67 // shut down from the point of view of this datatype. |
68 // Note: Once disconnected, you cannot reconnect without creating a new | 68 // Note: Once disconnected, you cannot reconnect without creating a new |
69 // SharedChangeProcessor. | 69 // SharedChangeProcessor. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 bool disconnected_; | 104 bool disconnected_; |
105 | 105 |
106 scoped_ptr<GenericChangeProcessor> generic_change_processor_; | 106 scoped_ptr<GenericChangeProcessor> generic_change_processor_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(SharedChangeProcessor); | 108 DISALLOW_COPY_AND_ASSIGN(SharedChangeProcessor); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace browser_sync | 111 } // namespace browser_sync |
112 | 112 |
113 #endif // CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ | 113 #endif // CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ |
OLD | NEW |