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

Side by Side Diff: chrome/browser/sync/engine/sync_scheduler.h

Issue 9251035: Delete lots of sync ServerConnectionManager code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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) 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 // A class to schedule syncer tasks intelligently. 5 // A class to schedule syncer tasks intelligently.
6 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ 6 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_
7 #define CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ 7 #define CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_
8 #pragma once 8 #pragma once
9 9
10 #include <string> 10 #include <string>
(...skipping 19 matching lines...) Expand all
30 class MessageLoop; 30 class MessageLoop;
31 31
32 namespace tracked_objects { 32 namespace tracked_objects {
33 class Location; 33 class Location;
34 } // namespace tracked_objects 34 } // namespace tracked_objects
35 35
36 namespace browser_sync { 36 namespace browser_sync {
37 37
38 struct ServerConnectionEvent; 38 struct ServerConnectionEvent;
39 39
40 class SyncScheduler : public sessions::SyncSession::Delegate, 40 class SyncScheduler : public sessions::SyncSession::Delegate {
41 public ServerConnectionEventListener {
42 public: 41 public:
43 enum Mode { 42 enum Mode {
44 // In this mode, the thread only performs configuration tasks. This is 43 // In this mode, the thread only performs configuration tasks. This is
45 // designed to make the case where we want to download updates for a 44 // designed to make the case where we want to download updates for a
46 // specific type only, and not continue syncing until we are moved into 45 // specific type only, and not continue syncing until we are moved into
47 // normal mode. 46 // normal mode.
48 CONFIGURATION_MODE, 47 CONFIGURATION_MODE,
49 // Resumes polling and allows nudges, drops configuration tasks. Runs 48 // Resumes polling and allows nudges, drops configuration tasks. Runs
50 // through entire sync cycle. 49 // through entire sync cycle.
51 NORMAL_MODE, 50 NORMAL_MODE,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 virtual void OnReceivedShortPollIntervalUpdate( 115 virtual void OnReceivedShortPollIntervalUpdate(
117 const base::TimeDelta& new_interval) OVERRIDE; 116 const base::TimeDelta& new_interval) OVERRIDE;
118 virtual void OnReceivedLongPollIntervalUpdate( 117 virtual void OnReceivedLongPollIntervalUpdate(
119 const base::TimeDelta& new_interval) OVERRIDE; 118 const base::TimeDelta& new_interval) OVERRIDE;
120 virtual void OnReceivedSessionsCommitDelay( 119 virtual void OnReceivedSessionsCommitDelay(
121 const base::TimeDelta& new_delay) OVERRIDE; 120 const base::TimeDelta& new_delay) OVERRIDE;
122 virtual void OnShouldStopSyncingPermanently() OVERRIDE; 121 virtual void OnShouldStopSyncingPermanently() OVERRIDE;
123 virtual void OnSyncProtocolError( 122 virtual void OnSyncProtocolError(
124 const sessions::SyncSessionSnapshot& snapshot) OVERRIDE; 123 const sessions::SyncSessionSnapshot& snapshot) OVERRIDE;
125 124
126 // ServerConnectionEventListener implementation. 125 // Forces the scheduler to make another attempt to contact the server.
127 // TODO(tim): schedule a nudge when valid connection detected? in 1 minute? 126 //
128 virtual void OnServerConnectionEvent( 127 // Does not override THROTTLED state. Should be called when some client-side
129 const ServerConnectionEvent& event) OVERRIDE; 128 // event, such as an IP address change or the receipt of new auth credentials,
129 // imporoves our odds of successfully contacting the server.
130 //
131 // WARNING: This function will also lead to retries in the case where our
132 // connection to the server was perfectly fine. If used improperly, this
133 // function coudl DoS the server.
134 //
135 // WARNING: This function is synchronous. Do not call it unless you are
136 // prepared to wait the duration of a sync cycle.
137 void TryToConnect();
130 138
131 private: 139 private:
132 enum JobProcessDecision { 140 enum JobProcessDecision {
133 // Indicates we should continue with the current job. 141 // Indicates we should continue with the current job.
134 CONTINUE, 142 CONTINUE,
135 // Indicates that we should save it to be processed later. 143 // Indicates that we should save it to be processed later.
136 SAVE, 144 SAVE,
137 // Indicates we should drop this job. 145 // Indicates we should drop this job.
138 DROP, 146 DROP,
139 }; 147 };
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 341
334 // Creates a session for a poll and performs the sync. 342 // Creates a session for a poll and performs the sync.
335 void PollTimerCallback(); 343 void PollTimerCallback();
336 344
337 // Assign |start| and |end| to appropriate SyncerStep values for the 345 // Assign |start| and |end| to appropriate SyncerStep values for the
338 // specified |purpose|. 346 // specified |purpose|.
339 void SetSyncerStepsForPurpose(SyncSessionJob::SyncSessionJobPurpose purpose, 347 void SetSyncerStepsForPurpose(SyncSessionJob::SyncSessionJobPurpose purpose,
340 SyncerStep* start, 348 SyncerStep* start,
341 SyncerStep* end); 349 SyncerStep* end);
342 350
343 // Initializes the hookup between the ServerConnectionManager and us.
344 void WatchConnectionManager();
345
346 // Used to update |server_connection_ok_|, see below. 351 // Used to update |server_connection_ok_|, see below.
347 void CheckServerConnectionManagerStatus( 352 void CheckServerConnectionManagerStatus(
348 HttpResponse::ServerConnectionCode code); 353 HttpResponse::ServerConnectionCode code);
349 354
350 // Called once the first time thread_ is started to broadcast an initial 355 // Called once the first time thread_ is started to broadcast an initial
351 // session snapshot containing data like initial_sync_ended. Important when 356 // session snapshot containing data like initial_sync_ended. Important when
352 // the client starts up and does not need to perform an initial sync. 357 // the client starts up and does not need to perform an initial sync.
353 void SendInitialSnapshot(); 358 void SendInitialSnapshot();
354 359
355 virtual void OnActionableError(const sessions::SyncSessionSnapshot& snapshot); 360 virtual void OnActionableError(const sessions::SyncSessionSnapshot& snapshot);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 scoped_ptr<Syncer> syncer_; 411 scoped_ptr<Syncer> syncer_;
407 412
408 scoped_ptr<sessions::SyncSessionContext> session_context_; 413 scoped_ptr<sessions::SyncSessionContext> session_context_;
409 414
410 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); 415 DISALLOW_COPY_AND_ASSIGN(SyncScheduler);
411 }; 416 };
412 417
413 } // namespace browser_sync 418 } // namespace browser_sync
414 419
415 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ 420 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698