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

Side by Side Diff: components/sync/driver/async_directory_type_controller.h

Issue 2549223003: [Sync] Rename NonUIDataTypeController to AsyncDirectoryTypeController (Closed)
Patch Set: Created 4 years 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
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 COMPONENTS_SYNC_DRIVER_NON_UI_DATA_TYPE_CONTROLLER_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_ASYNC_DIRECTORY_TYPE_CONTROLLER_H_
6 #define COMPONENTS_SYNC_DRIVER_NON_UI_DATA_TYPE_CONTROLLER_H_ 6 #define COMPONENTS_SYNC_DRIVER_ASYNC_DIRECTORY_TYPE_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/sequenced_task_runner.h" 14 #include "base/sequenced_task_runner.h"
15 #include "components/sync/driver/directory_data_type_controller.h" 15 #include "components/sync/driver/directory_data_type_controller.h"
16 #include "components/sync/driver/shared_change_processor.h" 16 #include "components/sync/driver/shared_change_processor.h"
17 17
18 namespace syncer { 18 namespace syncer {
19 19
20 class SyncClient; 20 class SyncClient;
21 struct UserShare; 21 struct UserShare;
22 22
23 // Implementation for datatypes that reside on non-UI thread. All interaction 23 // Implementation for directory based datatypes that interact with their
24 // with datatype controller happens on UI thread. Calls to SyncableService are 24 // syncable services by posting to model thread. All interaction with datatype
25 // posted to model thread through PostTaskOnModelThread(). 25 // controller happens on UI thread.
26 // Note: RefCountedThreadSafe by way of DataTypeController. 26 class AsyncDirectoryTypeController : public DirectoryDataTypeController {
27 class NonUIDataTypeController : public DirectoryDataTypeController {
28 public: 27 public:
29 // |dump_stack| is called when an unrecoverable error occurs. 28 // |dump_stack| is called when an unrecoverable error occurs.
30 NonUIDataTypeController( 29 AsyncDirectoryTypeController(
31 ModelType type, 30 ModelType type,
32 const base::Closure& dump_stack, 31 const base::Closure& dump_stack,
33 SyncClient* sync_client, 32 SyncClient* sync_client,
34 ModelSafeGroup model_safe_group, 33 ModelSafeGroup model_safe_group,
35 scoped_refptr<base::SequencedTaskRunner> model_thread); 34 scoped_refptr<base::SequencedTaskRunner> model_thread);
36 ~NonUIDataTypeController() override; 35 ~AsyncDirectoryTypeController() override;
37 36
38 // DataTypeController interface. 37 // DataTypeController interface.
39 void LoadModels(const ModelLoadCallback& model_load_callback) override; 38 void LoadModels(const ModelLoadCallback& model_load_callback) override;
40 void StartAssociating(const StartCallback& start_callback) override; 39 void StartAssociating(const StartCallback& start_callback) override;
41 void Stop() override; 40 void Stop() override;
42 ChangeProcessor* GetChangeProcessor() const override; 41 ChangeProcessor* GetChangeProcessor() const override;
43 std::string name() const override; 42 std::string name() const override;
44 State state() const override; 43 State state() const override;
45 44
46 // Used by tests to override the factory used to create 45 // Used by tests to override the factory used to create
47 // GenericChangeProcessors. 46 // GenericChangeProcessors.
48 void SetGenericChangeProcessorFactoryForTest( 47 void SetGenericChangeProcessorFactoryForTest(
49 std::unique_ptr<GenericChangeProcessorFactory> factory); 48 std::unique_ptr<GenericChangeProcessorFactory> factory);
50 49
51 protected: 50 protected:
52 // For testing only. 51 // For testing only.
53 NonUIDataTypeController(); 52 AsyncDirectoryTypeController();
54 53
55 // Start any dependent services that need to be running before we can 54 // Start any dependent services that need to be running before we can
56 // associate models. The default implementation is a no-op. 55 // associate models. The default implementation is a no-op.
57 // Return value: 56 // Return value:
58 // True - if models are ready and association can proceed. 57 // True - if models are ready and association can proceed.
59 // False - if models are not ready. StartAssociationAsync should be called 58 // False - if models are not ready. StartAssociationAsync should be called
60 // when the models are ready. 59 // when the models are ready.
61 // Note: this is performed on the UI thread. 60 // Note: this is performed on the UI thread.
62 virtual bool StartModels(); 61 virtual bool StartModels();
63 62
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // thread and passed on to the backend thread. This reference is 143 // thread and passed on to the backend thread. This reference is
145 // released on the UI thread in Stop()/StartDoneImpl(), but the 144 // released on the UI thread in Stop()/StartDoneImpl(), but the
146 // backend thread may still have references to it (which is okay, 145 // backend thread may still have references to it (which is okay,
147 // since we call Disconnect() before releasing the UI thread 146 // since we call Disconnect() before releasing the UI thread
148 // reference). 147 // reference).
149 scoped_refptr<SharedChangeProcessor> shared_change_processor_; 148 scoped_refptr<SharedChangeProcessor> shared_change_processor_;
150 }; 149 };
151 150
152 } // namespace syncer 151 } // namespace syncer
153 152
154 #endif // COMPONENTS_SYNC_DRIVER_NON_UI_DATA_TYPE_CONTROLLER_H_ 153 #endif // COMPONENTS_SYNC_DRIVER_ASYNC_DIRECTORY_TYPE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698