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 COMPONENTS_SYNC_CORE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_ |
6 #define COMPONENTS_SYNC_CORE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_ | 6 #define COMPONENTS_SYNC_CORE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
12 #include "components/sync/base/model_type.h" | 12 #include "components/sync/base/model_type.h" |
13 #include "components/sync/core/model_type_connector.h" | 13 #include "components/sync/core/model_type_connector.h" |
14 | 14 |
15 namespace syncer { | 15 namespace syncer_v2 { |
16 | 16 |
17 // Proxies all ModelTypeConnector calls to another thread. Typically used by | 17 // Proxies all ModelTypeConnector calls to another thread. Typically used by |
18 // the SyncBackend to call from the UI thread to the real ModelTypeConnector on | 18 // the SyncBackend to call from the UI thread to the real ModelTypeConnector on |
19 // the sync thread. | 19 // the sync thread. |
20 class ModelTypeConnectorProxy : public ModelTypeConnector { | 20 class ModelTypeConnectorProxy : public ModelTypeConnector { |
21 public: | 21 public: |
22 ModelTypeConnectorProxy( | 22 ModelTypeConnectorProxy( |
23 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 23 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
24 const base::WeakPtr<ModelTypeConnector>& model_type_connector); | 24 const base::WeakPtr<ModelTypeConnector>& model_type_connector); |
25 ~ModelTypeConnectorProxy() override; | 25 ~ModelTypeConnectorProxy() override; |
26 | 26 |
27 // ModelTypeConnector implementation | 27 // ModelTypeConnector implementation |
28 void ConnectType( | 28 void ConnectType( |
29 ModelType type, | 29 syncer::ModelType type, |
30 std::unique_ptr<ActivationContext> activation_context) override; | 30 std::unique_ptr<ActivationContext> activation_context) override; |
31 void DisconnectType(ModelType type) override; | 31 void DisconnectType(syncer::ModelType type) override; |
32 | 32 |
33 private: | 33 private: |
34 // A SequencedTaskRunner representing the thread where the ModelTypeConnector | 34 // A SequencedTaskRunner representing the thread where the ModelTypeConnector |
35 // lives. | 35 // lives. |
36 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 36 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
37 | 37 |
38 // The ModelTypeConnector this object is wrapping. | 38 // The ModelTypeConnector this object is wrapping. |
39 base::WeakPtr<ModelTypeConnector> model_type_connector_; | 39 base::WeakPtr<ModelTypeConnector> model_type_connector_; |
40 }; | 40 }; |
41 | 41 |
42 } // namespace syncer | 42 } // namespace syncer_v2 |
43 | 43 |
44 #endif // COMPONENTS_SYNC_CORE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_ | 44 #endif // COMPONENTS_SYNC_CORE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_ |
OLD | NEW |