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

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

Issue 6270006: Revert 72685 - [SYNC] Refactor SyncSourceInfo and add support in chrome inval... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 <map>
19 #include <string>
20 #include <utility> 18 #include <utility>
21 #include <vector> 19 #include <vector>
22 20
23 #include "base/basictypes.h" 21 #include "base/basictypes.h"
24 #include "base/scoped_ptr.h" 22 #include "base/scoped_ptr.h"
25 #include "base/time.h" 23 #include "base/time.h"
26 #include "chrome/browser/sync/engine/model_safe_worker.h"
27 #include "chrome/browser/sync/sessions/ordered_commit_set.h" 24 #include "chrome/browser/sync/sessions/ordered_commit_set.h"
28 #include "chrome/browser/sync/sessions/session_state.h" 25 #include "chrome/browser/sync/sessions/session_state.h"
29 #include "chrome/browser/sync/sessions/status_controller.h" 26 #include "chrome/browser/sync/sessions/status_controller.h"
30 #include "chrome/browser/sync/sessions/sync_session_context.h" 27 #include "chrome/browser/sync/sessions/sync_session_context.h"
31 #include "chrome/browser/sync/syncable/model_type.h"
32 #include "chrome/browser/sync/util/extensions_activity_monitor.h" 28 #include "chrome/browser/sync/util/extensions_activity_monitor.h"
33 29
34 namespace syncable { 30 namespace syncable {
35 class WriteTransaction; 31 class WriteTransaction;
36 } 32 }
37 33
38 namespace browser_sync { 34 namespace browser_sync {
39 class ModelSafeWorker; 35 class ModelSafeWorker;
40 36
41 namespace sessions { 37 namespace sessions {
42 38
43 // A container that contains a set of datatypes with possible string payloads.
44 typedef std::map<syncable::ModelType, std::string> TypePayloadMap;
45
46 // Helper utils for building TypePayloadMaps.
47 // Convert a ModelTypeBitset into a TypePayloadMap using a default payload.
48 TypePayloadMap ModelTypeBitSetToTypePayloadMap(
49 const syncable::ModelTypeBitSet& types,
50 const std::string& payload);
51 // Convert a ModelSafeRoutingInfo into a TypePayloadMap using a default payload.
52 TypePayloadMap RoutingInfoToTypePayloadMap(
53 const ModelSafeRoutingInfo& routes,
54 const std::string& payload);
55 // Coalesce |update| into |original|, overwriting only when |update| has
56 // a non-empty payload.
57 void CoalescePayloads(TypePayloadMap* original, const TypePayloadMap& update);
58
59 // A container for the source of a sync session. This includes the update
60 // source, the datatypes triggering the sync session, and possible session
61 // specific payloads which should be sent to the server.
62 struct SyncSourceInfo {
63 SyncSourceInfo();
64 SyncSourceInfo(
65 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u,
66 const TypePayloadMap& t);
67
68 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source;
69 TypePayloadMap types;
70 };
71
72 class SyncSession { 39 class SyncSession {
73 public: 40 public:
74 // The Delegate services events that occur during the session requiring an 41 // The Delegate services events that occur during the session requiring an
75 // explicit (and session-global) action, as opposed to events that are simply 42 // explicit (and session-global) action, as opposed to events that are simply
76 // recorded in per-session state. 43 // recorded in per-session state.
77 class Delegate { 44 class Delegate {
78 public: 45 public:
79 // The client was throttled and should cease-and-desist syncing activity 46 // The client was throttled and should cease-and-desist syncing activity
80 // until the specified time. 47 // until the specified time.
81 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) = 0; 48 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) = 0;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 173
207 private: 174 private:
208 SyncSession* session_; 175 SyncSession* session_;
209 DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction); 176 DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction);
210 }; 177 };
211 178
212 } // namespace sessions 179 } // namespace sessions
213 } // namespace browser_sync 180 } // namespace browser_sync
214 181
215 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_ 182 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/notifier/server_notifier_thread.cc ('k') | chrome/browser/sync/sessions/sync_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698