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

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

Issue 152013003: Split up SyncEngineEventListener callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Try to fix chunk mismatch Created 6 years, 10 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 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 // 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 throughout the sync cycle. The SyncSession is not reused across 7 // bundle throughout the sync cycle. The SyncSession is not reused across
8 // sync cycles; each cycle starts with a new one. 8 // sync cycles; each cycle starts with a new one.
9 9
10 #ifndef SYNC_SESSIONS_SYNC_SESSION_H_ 10 #ifndef SYNC_SESSIONS_SYNC_SESSION_H_
11 #define SYNC_SESSIONS_SYNC_SESSION_H_ 11 #define SYNC_SESSIONS_SYNC_SESSION_H_
12 12
13 #include <map> 13 #include <map>
14 #include <set> 14 #include <set>
15 #include <string> 15 #include <string>
16 #include <utility> 16 #include <utility>
17 #include <vector> 17 #include <vector>
18 18
19 #include "base/basictypes.h" 19 #include "base/basictypes.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "sync/base/sync_export.h" 22 #include "sync/base/sync_export.h"
23 #include "sync/internal_api/public/base/model_type.h" 23 #include "sync/internal_api/public/base/model_type.h"
24 #include "sync/internal_api/public/engine/model_safe_worker.h" 24 #include "sync/internal_api/public/engine/model_safe_worker.h"
25 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" 25 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
26 #include "sync/protocol/sync_protocol_error.h"
26 #include "sync/sessions/status_controller.h" 27 #include "sync/sessions/status_controller.h"
27 #include "sync/sessions/sync_session_context.h" 28 #include "sync/sessions/sync_session_context.h"
28 29
29 namespace syncer { 30 namespace syncer {
30 class ModelSafeWorker; 31 class ModelSafeWorker;
31 32
32 namespace sessions { 33 namespace sessions {
33 34
34 class NudgeTracker; 35 class NudgeTracker;
35 36
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 virtual void OnReceivedLongPollIntervalUpdate( 69 virtual void OnReceivedLongPollIntervalUpdate(
69 const base::TimeDelta& new_interval) = 0; 70 const base::TimeDelta& new_interval) = 0;
70 71
71 // The client has been instructed to change its sessions commit 72 // The client has been instructed to change its sessions commit
72 // delay. 73 // delay.
73 virtual void OnReceivedSessionsCommitDelay( 74 virtual void OnReceivedSessionsCommitDelay(
74 const base::TimeDelta& new_delay) = 0; 75 const base::TimeDelta& new_delay) = 0;
75 76
76 // Called for the syncer to respond to the error sent by the server. 77 // Called for the syncer to respond to the error sent by the server.
77 virtual void OnSyncProtocolError( 78 virtual void OnSyncProtocolError(
78 const sessions::SyncSessionSnapshot& snapshot) = 0; 79 const SyncProtocolError& sync_protocol_error) = 0;
79 80
80 // Called when the server wants to change the number of hints the client 81 // Called when the server wants to change the number of hints the client
81 // will buffer locally. 82 // will buffer locally.
82 virtual void OnReceivedClientInvalidationHintBufferSize(int size) = 0; 83 virtual void OnReceivedClientInvalidationHintBufferSize(int size) = 0;
83 84
84 // Called when server wants to schedule a retry GU. 85 // Called when server wants to schedule a retry GU.
85 virtual void OnReceivedGuRetryDelay(const base::TimeDelta& delay) = 0; 86 virtual void OnReceivedGuRetryDelay(const base::TimeDelta& delay) = 0;
86 87
87 protected: 88 protected:
88 virtual ~Delegate() {} 89 virtual ~Delegate() {}
89 }; 90 };
90 91
91 // Build a session without a nudge tracker. Used for poll or configure type 92 // Build a session without a nudge tracker. Used for poll or configure type
92 // sync cycles. 93 // sync cycles.
93 static SyncSession* Build(SyncSessionContext* context, 94 static SyncSession* Build(SyncSessionContext* context,
94 Delegate* delegate); 95 Delegate* delegate);
95 ~SyncSession(); 96 ~SyncSession();
96 97
97 // Builds a thread-safe and read-only copy of the current session state. 98 // Builds a thread-safe and read-only copy of the current session state.
98 SyncSessionSnapshot TakeSnapshot() const; 99 SyncSessionSnapshot TakeSnapshot() const;
99 SyncSessionSnapshot TakeSnapshotWithSource( 100 SyncSessionSnapshot TakeSnapshotWithSource(
100 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource legacy_updates_source) 101 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource legacy_updates_source)
101 const; 102 const;
102 103
103 // Builds and sends a snapshot to the session context's listeners. 104 // Builds and sends a snapshot to the session context's listeners.
104 void SendSyncCycleEndEventNotification( 105 void SendSyncCycleEndEventNotification(
105 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); 106 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source);
106 void SendEventNotification(SyncEngineEvent::EventCause cause); 107 void SendEventNotification(SyncCycleEvent::EventCause cause);
107 108
108 // TODO(akalin): Split this into context() and mutable_context(). 109 // TODO(akalin): Split this into context() and mutable_context().
109 SyncSessionContext* context() const { return context_; } 110 SyncSessionContext* context() const { return context_; }
110 Delegate* delegate() const { return delegate_; } 111 Delegate* delegate() const { return delegate_; }
111 const StatusController& status_controller() const { 112 const StatusController& status_controller() const {
112 return *status_controller_.get(); 113 return *status_controller_.get();
113 } 114 }
114 StatusController* mutable_status_controller() { 115 StatusController* mutable_status_controller() {
115 return status_controller_.get(); 116 return status_controller_.get();
116 } 117 }
(...skipping 10 matching lines...) Expand all
127 // Our controller for various status and error counters. 128 // Our controller for various status and error counters.
128 scoped_ptr<StatusController> status_controller_; 129 scoped_ptr<StatusController> status_controller_;
129 130
130 DISALLOW_COPY_AND_ASSIGN(SyncSession); 131 DISALLOW_COPY_AND_ASSIGN(SyncSession);
131 }; 132 };
132 133
133 } // namespace sessions 134 } // namespace sessions
134 } // namespace syncer 135 } // namespace syncer
135 136
136 #endif // SYNC_SESSIONS_SYNC_SESSION_H_ 137 #endif // SYNC_SESSIONS_SYNC_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698