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

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

Issue 1368683003: USS SyncContextProxy / data type activation refactoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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_SYNC_CONTEXT_PROXY_IMPL_H_ 5 #ifndef SYNC_INTERNAL_API_SYNC_CONTEXT_PROXY_IMPL_H_
6 #define SYNC_INTERNAL_API_SYNC_CONTEXT_PROXY_IMPL_H_ 6 #define SYNC_INTERNAL_API_SYNC_CONTEXT_PROXY_IMPL_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.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 #include "sync/internal_api/public/sync_context_proxy.h" 13 #include "sync/internal_api/public/sync_context_proxy.h"
14 14
15 namespace syncer_v2 { 15 namespace syncer_v2 {
16 class ModelTypeProcessor; 16 class ModelTypeProcessor;
17 class SyncContext; 17 class SyncContext;
18 struct DataTypeState; 18 struct DataTypeState;
pavely 2015/09/25 18:22:39 ModelTypeProcessor and DataTypeState are no longer
stanisc 2015/09/26 00:16:01 Done.
19 19
20 // Encapsulates a reference to the sync context and the thread it's running on. 20 // Encapsulates a reference to the sync context and the thread it's running on.
21 // Used by sync's data types to connect with the sync context. 21 // Used by sync's data types to connect with the sync context.
22 // 22 //
23 // It is expected that this object will be copied to and used on many different 23 // It is expected that this object will be copied to and used on many different
24 // threads. It is small and safe to pass by value. 24 // threads. It is small and safe to pass by value.
25 class SYNC_EXPORT_PRIVATE SyncContextProxyImpl : public SyncContextProxy { 25 class SYNC_EXPORT_PRIVATE SyncContextProxyImpl : public SyncContextProxy {
26 public: 26 public:
27 SyncContextProxyImpl( 27 SyncContextProxyImpl(
28 const scoped_refptr<base::SequencedTaskRunner>& sync_task_runner, 28 const scoped_refptr<base::SequencedTaskRunner>& sync_task_runner,
29 const base::WeakPtr<SyncContext>& sync_context); 29 const base::WeakPtr<SyncContext>& sync_context);
30 ~SyncContextProxyImpl() override; 30 ~SyncContextProxyImpl() override;
31 31
32 // Attempts to connect a non-blocking type to the sync context. 32 // Attempts to connect a non-blocking type to the sync context.
33 // 33 //
34 // This may fail under some unusual circumstances, like shutdown. Due to the 34 // This may fail under some unusual circumstances, like shutdown. Due to the
35 // nature of WeakPtrs and cross-thread communication, the caller will be 35 // nature of WeakPtrs and cross-thread communication, the caller will be
36 // unable to distinguish a slow success from failure. 36 // unable to distinguish a slow success from failure.
37 //
38 // Must be called from the thread where the data type lives.
39 void ConnectTypeToSync( 37 void ConnectTypeToSync(
40 syncer::ModelType type, 38 syncer::ModelType type,
41 const DataTypeState& data_type_state, 39 scoped_ptr<ActivationContext> activation_context) override;
42 const UpdateResponseDataList& pending_updates,
43 const base::WeakPtr<ModelTypeProcessor>& type_processor) override;
44 40
45 // Disables syncing for the given type on the sync thread. 41 // Disables syncing for the given type on the sync thread.
46 void Disconnect(syncer::ModelType type) override; 42 void Disconnect(syncer::ModelType type) override;
47 43
48 scoped_ptr<SyncContextProxy> Clone() const override; 44 scoped_ptr<SyncContextProxy> Clone() const override;
49 45
50 private: 46 private:
51 // A SequencedTaskRunner representing the thread where the SyncContext lives. 47 // A SequencedTaskRunner representing the thread where the SyncContext lives.
52 scoped_refptr<base::SequencedTaskRunner> sync_task_runner_; 48 scoped_refptr<base::SequencedTaskRunner> sync_task_runner_;
53 49
54 // The SyncContext this object is wrapping. 50 // The SyncContext this object is wrapping.
55 base::WeakPtr<SyncContext> sync_context_; 51 base::WeakPtr<SyncContext> sync_context_;
56 }; 52 };
57 53
58 } // namespace syncer 54 } // namespace syncer
59 55
60 #endif // SYNC_INTERNAL_API_SYNC_CONTEXT_PROXY_IMPL_H_ 56 #endif // SYNC_INTERNAL_API_SYNC_CONTEXT_PROXY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698