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

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

Issue 6182004: [SYNC] Refactor SyncSourceInfo and add support in chrome invalidation client ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: vector->map + comments Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // A class representing an attempt to synchronize the local syncable data 5 // A class representing an attempt to synchronize the local syncable data
6 // store with a sync server. A SyncSession instance is passed as a stateful 6 // store with a sync server. A SyncSession instance is passed as a stateful
7 // bundle to and from various SyncerCommands with the goal of converging the 7 // bundle to and from various SyncerCommands with the goal of converging the
8 // client view of data with that of the server. The commands twiddle with 8 // client view of data with that of the server. The commands twiddle with
9 // session status in response to events and hiccups along the way, set and 9 // session status in response to events and hiccups along the way, set and
10 // query session progress with regards to conflict resolution and applying 10 // query session progress with regards to conflict resolution and applying
11 // server updates, and access the SyncSessionContext for the current session 11 // server updates, and access the SyncSessionContext for the current session
12 // via SyncSession instances. 12 // via SyncSession instances.
13 13
14 #ifndef CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_ 14 #ifndef CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_
15 #define CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_ 15 #define CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_
16 #pragma once 16 #pragma once
17 17
18 #include <string>
18 #include <utility> 19 #include <utility>
19 #include <vector> 20 #include <vector>
20 21
21 #include "base/basictypes.h" 22 #include "base/basictypes.h"
22 #include "base/scoped_ptr.h" 23 #include "base/scoped_ptr.h"
23 #include "base/time.h" 24 #include "base/time.h"
24 #include "chrome/browser/sync/sessions/ordered_commit_set.h" 25 #include "chrome/browser/sync/sessions/ordered_commit_set.h"
25 #include "chrome/browser/sync/sessions/session_state.h" 26 #include "chrome/browser/sync/sessions/session_state.h"
26 #include "chrome/browser/sync/sessions/status_controller.h" 27 #include "chrome/browser/sync/sessions/status_controller.h"
27 #include "chrome/browser/sync/sessions/sync_session_context.h" 28 #include "chrome/browser/sync/sessions/sync_session_context.h"
28 #include "chrome/browser/sync/util/extensions_activity_monitor.h" 29 #include "chrome/browser/sync/util/extensions_activity_monitor.h"
29 30
30 namespace syncable { 31 namespace syncable {
31 class WriteTransaction; 32 class WriteTransaction;
32 } 33 }
33 34
34 namespace browser_sync { 35 namespace browser_sync {
35 class ModelSafeWorker; 36 class ModelSafeWorker;
36 37
37 namespace sessions { 38 namespace sessions {
38 typedef std::pair<sync_pb::GetUpdatesCallerInfo::GetUpdatesSource, 39 // A container for the source of a sync session. This includes the update
39 syncable::ModelTypeBitSet> SyncSourceInfo; 40 // source, the datatypes triggering the sync session, and possible session
41 // specific payloads which should be sent to the server.
42 struct SyncSourceInfo {
43 SyncSourceInfo()
44 : updates_source(sync_pb::GetUpdatesCallerInfo::UNKNOWN) {}
45 SyncSourceInfo(
46 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u,
47 const syncable::ModelTypeBitSet& t)
48 : updates_source(u), types(t) {}
49 SyncSourceInfo(
50 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u,
51 const syncable::ModelTypeBitSet& t,
52 const std::map<syncable::ModelType, std::string>& p)
53 : updates_source(u), types(t), payloads(p) {}
54
55 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source;
56 syncable::ModelTypeBitSet types;
57 std::map<syncable::ModelType, std::string> payloads;
58 };
40 59
41 class SyncSession { 60 class SyncSession {
42 public: 61 public:
43 // The Delegate services events that occur during the session requiring an 62 // The Delegate services events that occur during the session requiring an
44 // explicit (and session-global) action, as opposed to events that are simply 63 // explicit (and session-global) action, as opposed to events that are simply
45 // recorded in per-session state. 64 // recorded in per-session state.
46 class Delegate { 65 class Delegate {
47 public: 66 public:
48 // The client was throttled and should cease-and-desist syncing activity 67 // The client was throttled and should cease-and-desist syncing activity
49 // until the specified time. 68 // until the specified time.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 182
164 private: 183 private:
165 SyncSession* session_; 184 SyncSession* session_;
166 DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction); 185 DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction);
167 }; 186 };
168 187
169 } // namespace sessions 188 } // namespace sessions
170 } // namespace browser_sync 189 } // namespace browser_sync
171 190
172 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_ 191 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698