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

Side by Side Diff: sync/sessions/sync_session_context.h

Issue 9826035: [Sync] Display the client server traffic log in about:sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // SyncSessionContext encapsulates the contextual information and engine
6 // components specific to a SyncSession. A context is accessible via 6 // components specific to a SyncSession. A context is accessible via
7 // a SyncSession so that session SyncerCommands and parts of the engine have 7 // a SyncSession so that session SyncerCommands and parts of the engine have
8 // a convenient way to access other parts. In this way it can be thought of as 8 // a convenient way to access other parts. In this way it can be thought of as
9 // the surrounding environment for the SyncSession. The components of this 9 // the surrounding environment for the SyncSession. The components of this
10 // environment are either valid or not valid for the entire context lifetime, 10 // environment are either valid or not valid for the entire context lifetime,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 struct SyncSessionSnapshot; 49 struct SyncSessionSnapshot;
50 class TestScopedSessionEventListener; 50 class TestScopedSessionEventListener;
51 51
52 class SyncSessionContext { 52 class SyncSessionContext {
53 public: 53 public:
54 SyncSessionContext(ServerConnectionManager* connection_manager, 54 SyncSessionContext(ServerConnectionManager* connection_manager,
55 syncable::Directory* directory, 55 syncable::Directory* directory,
56 ModelSafeWorkerRegistrar* model_safe_worker_registrar, 56 ModelSafeWorkerRegistrar* model_safe_worker_registrar,
57 ExtensionsActivityMonitor* extensions_activity_monitor, 57 ExtensionsActivityMonitor* extensions_activity_monitor,
58 const std::vector<SyncEngineEventListener*>& listeners, 58 const std::vector<SyncEngineEventListener*>& listeners,
59 DebugInfoGetter* debug_info_getter); 59 DebugInfoGetter* debug_info_getter,
60 browser_sync::TrafficRecorder* traffic_recorder);
60 61
61 // Empty constructor for unit tests. 62 // Empty constructor for unit tests.
62 SyncSessionContext(); 63 SyncSessionContext();
63 virtual ~SyncSessionContext(); 64 virtual ~SyncSessionContext();
64 65
65 ConflictResolver* resolver() { return resolver_; } 66 ConflictResolver* resolver() { return resolver_; }
66 ServerConnectionManager* connection_manager() { 67 ServerConnectionManager* connection_manager() {
67 return connection_manager_; 68 return connection_manager_;
68 } 69 }
69 syncable::Directory* directory() { 70 syncable::Directory* directory() {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 119
119 // This prunes the |unthrottle_time_| map based on the |time| passed in. This 120 // This prunes the |unthrottle_time_| map based on the |time| passed in. This
120 // is called by syncer at the SYNCER_BEGIN stage. 121 // is called by syncer at the SYNCER_BEGIN stage.
121 void PruneUnthrottledTypes(const base::TimeTicks& time); 122 void PruneUnthrottledTypes(const base::TimeTicks& time);
122 123
123 // This returns the list of currently throttled types. Unless server returns 124 // This returns the list of currently throttled types. Unless server returns
124 // new throttled types this will remain constant through out the sync cycle. 125 // new throttled types this will remain constant through out the sync cycle.
125 syncable::ModelTypeSet GetThrottledTypes() const; 126 syncable::ModelTypeSet GetThrottledTypes() const;
126 127
127 browser_sync::TrafficRecorder* traffic_recorder() { 128 browser_sync::TrafficRecorder* traffic_recorder() {
128 return &traffic_recorder_; 129 return traffic_recorder_;
129 } 130 }
130 131
131 private: 132 private:
132 typedef std::map<syncable::ModelType, base::TimeTicks> UnthrottleTimes; 133 typedef std::map<syncable::ModelType, base::TimeTicks> UnthrottleTimes;
133 134
134 FRIEND_TEST_ALL_PREFIXES(SyncSessionContextTest, AddUnthrottleTimeTest); 135 FRIEND_TEST_ALL_PREFIXES(SyncSessionContextTest, AddUnthrottleTimeTest);
135 FRIEND_TEST_ALL_PREFIXES(SyncSessionContextTest, 136 FRIEND_TEST_ALL_PREFIXES(SyncSessionContextTest,
136 GetCurrentlyThrottledTypesTest); 137 GetCurrentlyThrottledTypesTest);
137 138
138 // Rather than force clients to set and null-out various context members, we 139 // Rather than force clients to set and null-out various context members, we
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 scoped_ptr<sessions::SyncSessionSnapshot> previous_session_snapshot_; 176 scoped_ptr<sessions::SyncSessionSnapshot> previous_session_snapshot_;
176 177
177 // We use this to get debug info to send to the server for debugging 178 // We use this to get debug info to send to the server for debugging
178 // client behavior on server side. 179 // client behavior on server side.
179 DebugInfoGetter* const debug_info_getter_; 180 DebugInfoGetter* const debug_info_getter_;
180 181
181 // This is a map from throttled data types to the time at which they can be 182 // This is a map from throttled data types to the time at which they can be
182 // unthrottled. 183 // unthrottled.
183 UnthrottleTimes unthrottle_times_; 184 UnthrottleTimes unthrottle_times_;
184 185
185 browser_sync::TrafficRecorder traffic_recorder_; 186 browser_sync::TrafficRecorder* traffic_recorder_;
186 187
187 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); 188 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext);
188 }; 189 };
189 190
190 // Installs a ConflictResolver to a given session context for the lifetime of 191 // Installs a ConflictResolver to a given session context for the lifetime of
191 // the ScopedSessionContextConflictResolver. There should never be more than 192 // the ScopedSessionContextConflictResolver. There should never be more than
192 // one ConflictResolver in the system, so it is an error to use this if the 193 // one ConflictResolver in the system, so it is an error to use this if the
193 // context already has a resolver. 194 // context already has a resolver.
194 class ScopedSessionContextConflictResolver { 195 class ScopedSessionContextConflictResolver {
195 public: 196 public:
(...skipping 10 matching lines...) Expand all
206 private: 207 private:
207 SyncSessionContext* context_; 208 SyncSessionContext* context_;
208 ConflictResolver* resolver_; 209 ConflictResolver* resolver_;
209 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextConflictResolver); 210 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextConflictResolver);
210 }; 211 };
211 212
212 } // namespace sessions 213 } // namespace sessions
213 } // namespace browser_sync 214 } // namespace browser_sync
214 215
215 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ 216 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698