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

Side by Side Diff: components/sync/engine_impl/cycle/sync_cycle_context.h

Issue 2258873003: [Sync] Move sessions/ to engine/cycle/ and rename things to match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 // SyncSessionContext encapsulates the contextual information and engine 5 // SyncCycleContext encapsulates the contextual information and engine
6 // components specific to a SyncSession. Unlike the SyncSession, the context 6 // components specific to a SyncCycle. Unlike the SyncCycle, the context
7 // can be reused across several sync cycles. 7 // can be reused across several sync cycles.
8 // 8 //
9 // The context does not take ownership of its pointer members. It's up to 9 // The context does not take ownership of its pointer members. It's up to
10 // the surrounding classes to ensure those members remain valid while the 10 // the surrounding classes to ensure those members remain valid while the
11 // context is in use. 11 // context is in use.
12 // 12 //
13 // It can only be used from the SyncerThread. 13 // It can only be used from the SyncerThread.
14 14
15 #ifndef COMPONENTS_SYNC_SESSIONS_IMPL_SYNC_SESSION_CONTEXT_H_ 15 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_SYNC_CYCLE_CONTEXT_H_
16 #define COMPONENTS_SYNC_SESSIONS_IMPL_SYNC_SESSION_CONTEXT_H_ 16 #define COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_SYNC_CYCLE_CONTEXT_H_
17 17
18 #include <stdint.h> 18 #include <stdint.h>
19 19
20 #include <string> 20 #include <string>
21 #include <vector> 21 #include <vector>
22 22
23 #include "base/macros.h" 23 #include "base/macros.h"
24 #include "components/sync/engine_impl/cycle/debug_info_getter.h"
24 #include "components/sync/engine_impl/model_type_registry.h" 25 #include "components/sync/engine_impl/model_type_registry.h"
25 #include "components/sync/engine_impl/sync_engine_event_listener.h" 26 #include "components/sync/engine_impl/sync_engine_event_listener.h"
26 #include "components/sync/sessions_impl/debug_info_getter.h"
27 27
28 namespace syncer { 28 namespace syncer {
29 29
30 class ExtensionsActivity; 30 class ExtensionsActivity;
31 class ModelTypeRegistry; 31 class ModelTypeRegistry;
32 class ServerConnectionManager; 32 class ServerConnectionManager;
33 class TestScopedSessionEventListener;
skym 2016/08/19 17:17:43 Shouldn't need this forward declaration to friend
maxbogue 2016/08/19 19:12:01 You're right, I deleted it because it wasn't used.
33 34
34 namespace syncable { 35 namespace syncable {
35 class Directory; 36 class Directory;
36 } 37 }
37 38
38 // Default number of items a client can commit in a single message. 39 // Default number of items a client can commit in a single message.
39 static const int kDefaultMaxCommitBatchSize = 25; 40 static const int kDefaultMaxCommitBatchSize = 25;
40 41
41 namespace sessions { 42 class SyncCycleContext {
42 class TestScopedSessionEventListener; 43 public:
44 SyncCycleContext(ServerConnectionManager* connection_manager,
45 syncable::Directory* directory,
46 ExtensionsActivity* extensions_activity,
47 const std::vector<SyncEngineEventListener*>& listeners,
48 DebugInfoGetter* debug_info_getter,
49 ModelTypeRegistry* model_type_registry,
50 bool keystore_encryption_enabled,
51 bool client_enabled_pre_commit_update_avoidance,
52 const std::string& invalidator_client_id);
43 53
44 class SyncSessionContext { 54 ~SyncCycleContext();
45 public:
46 SyncSessionContext(ServerConnectionManager* connection_manager,
47 syncable::Directory* directory,
48 ExtensionsActivity* extensions_activity,
49 const std::vector<SyncEngineEventListener*>& listeners,
50 DebugInfoGetter* debug_info_getter,
51 ModelTypeRegistry* model_type_registry,
52 bool keystore_encryption_enabled,
53 bool client_enabled_pre_commit_update_avoidance,
54 const std::string& invalidator_client_id);
55
56 ~SyncSessionContext();
57 55
58 ServerConnectionManager* connection_manager() { return connection_manager_; } 56 ServerConnectionManager* connection_manager() { return connection_manager_; }
59 syncable::Directory* directory() { return directory_; } 57 syncable::Directory* directory() { return directory_; }
60 58
61 ModelTypeSet GetEnabledTypes() const; 59 ModelTypeSet GetEnabledTypes() const;
62 60
63 void SetRoutingInfo(const ModelSafeRoutingInfo& routing_info); 61 void SetRoutingInfo(const ModelSafeRoutingInfo& routing_info);
64 62
65 ExtensionsActivity* extensions_activity() { 63 ExtensionsActivity* extensions_activity() {
66 return extensions_activity_.get(); 64 return extensions_activity_.get();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 117 }
120 118
121 bool cookie_jar_empty() const { return cookie_jar_empty_; } 119 bool cookie_jar_empty() const { return cookie_jar_empty_; }
122 120
123 void set_cookie_jar_empty(bool empty_jar) { cookie_jar_empty_ = empty_jar; } 121 void set_cookie_jar_empty(bool empty_jar) { cookie_jar_empty_ = empty_jar; }
124 122
125 private: 123 private:
126 // Rather than force clients to set and null-out various context members, we 124 // Rather than force clients to set and null-out various context members, we
127 // extend our encapsulation boundary to scoped helpers that take care of this 125 // extend our encapsulation boundary to scoped helpers that take care of this
128 // once they are allocated. See definitions of these below. 126 // once they are allocated. See definitions of these below.
129 friend class TestScopedSessionEventListener; 127 friend class TestScopedSessionEventListener;
skym 2016/08/19 17:17:42 As far as I can tell, you deleted this class. So n
maxbogue 2016/08/19 19:12:01 Right you are!
130 128
131 base::ObserverList<SyncEngineEventListener> listeners_; 129 base::ObserverList<SyncEngineEventListener> listeners_;
132 130
133 ServerConnectionManager* const connection_manager_; 131 ServerConnectionManager* const connection_manager_;
134 syncable::Directory* const directory_; 132 syncable::Directory* const directory_;
135 133
136 // We use this to stuff extensions activity into CommitMessages so the server 134 // We use this to stuff extensions activity into CommitMessages so the server
137 // can correlate commit traffic with extension-related bookmark mutations. 135 // can correlate commit traffic with extension-related bookmark mutations.
138 scoped_refptr<ExtensionsActivity> extensions_activity_; 136 scoped_refptr<ExtensionsActivity> extensions_activity_;
139 137
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const bool client_enabled_pre_commit_update_avoidance_; 175 const bool client_enabled_pre_commit_update_avoidance_;
178 176
179 // Whether the account(s) present in the content area's cookie jar match the 177 // Whether the account(s) present in the content area's cookie jar match the
180 // chrome account. If multiple accounts are present in the cookie jar, a 178 // chrome account. If multiple accounts are present in the cookie jar, a
181 // mismatch implies all of them are different from the chrome account. 179 // mismatch implies all of them are different from the chrome account.
182 bool cookie_jar_mismatch_; 180 bool cookie_jar_mismatch_;
183 181
184 // If there's a cookie jar mismatch, whether the cookie jar was empty or not. 182 // If there's a cookie jar mismatch, whether the cookie jar was empty or not.
185 bool cookie_jar_empty_; 183 bool cookie_jar_empty_;
186 184
187 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); 185 DISALLOW_COPY_AND_ASSIGN(SyncCycleContext);
188 }; 186 };
189 187
190 } // namespace sessions
191 } // namespace syncer 188 } // namespace syncer
192 189
193 #endif // COMPONENTS_SYNC_SESSIONS_IMPL_SYNC_SESSION_CONTEXT_H_ 190 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_SYNC_CYCLE_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698