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

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

Issue 3078022: Unplumb AllStatus from SyncerThread. (Closed)
Patch Set: parens Created 10 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
« no previous file with comments | « chrome/browser/sync/engine/syncer_thread_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const std::string& account_name() { return account_name_; } 98 const std::string& account_name() { return account_name_; }
99 99
100 const ModelSafeRoutingInfo& previous_session_routing_info() const { 100 const ModelSafeRoutingInfo& previous_session_routing_info() const {
101 return previous_session_routing_info_; 101 return previous_session_routing_info_;
102 } 102 }
103 103
104 void set_previous_session_routing_info(const ModelSafeRoutingInfo& info) { 104 void set_previous_session_routing_info(const ModelSafeRoutingInfo& info) {
105 previous_session_routing_info_ = info; 105 previous_session_routing_info_ = info;
106 } 106 }
107 107
108 sessions::SyncSessionSnapshot* previous_session_snapshot() {
109 return previous_session_snapshot_.get();
110 }
111
112 void set_last_snapshot(const SyncSessionSnapshot& snapshot) {
113 previous_session_snapshot_.reset(new SyncSessionSnapshot(snapshot));
114 }
115
108 private: 116 private:
109 // Rather than force clients to set and null-out various context members, we 117 // Rather than force clients to set and null-out various context members, we
110 // extend our encapsulation boundary to scoped helpers that take care of this 118 // extend our encapsulation boundary to scoped helpers that take care of this
111 // once they are allocated. See definitions of these below. 119 // once they are allocated. See definitions of these below.
112 friend class ScopedSessionContextConflictResolver; 120 friend class ScopedSessionContextConflictResolver;
113 friend class ScopedSessionContextSyncerEventChannel; 121 friend class ScopedSessionContextSyncerEventChannel;
114 122
115 // These are installed by Syncer objects when needed and may be NULL. 123 // These are installed by Syncer objects when needed and may be NULL.
116 ConflictResolver* resolver_; 124 ConflictResolver* resolver_;
117 SyncerEventChannel* syncer_event_channel_; 125 SyncerEventChannel* syncer_event_channel_;
(...skipping 14 matching lines...) Expand all
132 // enabled. True only if the notification channel is authorized and open. 140 // enabled. True only if the notification channel is authorized and open.
133 bool notifications_enabled_; 141 bool notifications_enabled_;
134 142
135 // The name of the account being synced. 143 // The name of the account being synced.
136 std::string account_name_; 144 std::string account_name_;
137 145
138 // Some routing info history to help us clean up types that get disabled 146 // Some routing info history to help us clean up types that get disabled
139 // by the user. 147 // by the user.
140 ModelSafeRoutingInfo previous_session_routing_info_; 148 ModelSafeRoutingInfo previous_session_routing_info_;
141 149
150 // Cache of last session snapshot information.
151 scoped_ptr<sessions::SyncSessionSnapshot> previous_session_snapshot_;
152
142 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); 153 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext);
143 }; 154 };
144 155
145 // Installs a ConflictResolver to a given session context for the lifetime of 156 // Installs a ConflictResolver to a given session context for the lifetime of
146 // the ScopedSessionContextConflictResolver. There should never be more than 157 // the ScopedSessionContextConflictResolver. There should never be more than
147 // one ConflictResolver in the system, so it is an error to use this if the 158 // one ConflictResolver in the system, so it is an error to use this if the
148 // context already has a resolver. 159 // context already has a resolver.
149 class ScopedSessionContextConflictResolver { 160 class ScopedSessionContextConflictResolver {
150 public: 161 public:
151 // Note: |context| and |resolver| should outlive |this|. 162 // Note: |context| and |resolver| should outlive |this|.
(...skipping 30 matching lines...) Expand all
182 private: 193 private:
183 SyncSessionContext* context_; 194 SyncSessionContext* context_;
184 SyncerEventChannel* channel_; 195 SyncerEventChannel* channel_;
185 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextSyncerEventChannel); 196 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextSyncerEventChannel);
186 }; 197 };
187 198
188 } // namespace sessions 199 } // namespace sessions
189 } // namespace browser_sync 200 } // namespace browser_sync
190 201
191 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ 202 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_thread_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698