| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 virtual void OnSilencedUntil( | 109 virtual void OnSilencedUntil( |
| 110 const base::TimeTicks& silenced_until) OVERRIDE; | 110 const base::TimeTicks& silenced_until) OVERRIDE; |
| 111 virtual bool IsSyncingCurrentlySilenced() OVERRIDE; | 111 virtual bool IsSyncingCurrentlySilenced() OVERRIDE; |
| 112 virtual void OnReceivedShortPollIntervalUpdate( | 112 virtual void OnReceivedShortPollIntervalUpdate( |
| 113 const base::TimeDelta& new_interval) OVERRIDE; | 113 const base::TimeDelta& new_interval) OVERRIDE; |
| 114 virtual void OnReceivedLongPollIntervalUpdate( | 114 virtual void OnReceivedLongPollIntervalUpdate( |
| 115 const base::TimeDelta& new_interval) OVERRIDE; | 115 const base::TimeDelta& new_interval) OVERRIDE; |
| 116 virtual void OnReceivedSessionsCommitDelay( | 116 virtual void OnReceivedSessionsCommitDelay( |
| 117 const base::TimeDelta& new_delay) OVERRIDE; | 117 const base::TimeDelta& new_delay) OVERRIDE; |
| 118 virtual void OnShouldStopSyncingPermanently() OVERRIDE; | 118 virtual void OnShouldStopSyncingPermanently() OVERRIDE; |
| 119 virtual void OnSyncProtocolError(sessions::SyncSession* session) OVERRIDE; |
| 119 | 120 |
| 120 // ServerConnectionEventListener implementation. | 121 // ServerConnectionEventListener implementation. |
| 121 // TODO(tim): schedule a nudge when valid connection detected? in 1 minute? | 122 // TODO(tim): schedule a nudge when valid connection detected? in 1 minute? |
| 122 virtual void OnServerConnectionEvent( | 123 virtual void OnServerConnectionEvent( |
| 123 const ServerConnectionEvent& event) OVERRIDE; | 124 const ServerConnectionEvent& event) OVERRIDE; |
| 124 | 125 |
| 125 private: | 126 private: |
| 126 enum JobProcessDecision { | 127 enum JobProcessDecision { |
| 127 // Indicates we should continue with the current job. | 128 // Indicates we should continue with the current job. |
| 128 CONTINUE, | 129 CONTINUE, |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 342 |
| 342 // Used to update |server_connection_ok_|, see below. | 343 // Used to update |server_connection_ok_|, see below. |
| 343 void CheckServerConnectionManagerStatus( | 344 void CheckServerConnectionManagerStatus( |
| 344 HttpResponse::ServerConnectionCode code); | 345 HttpResponse::ServerConnectionCode code); |
| 345 | 346 |
| 346 // Called once the first time thread_ is started to broadcast an initial | 347 // Called once the first time thread_ is started to broadcast an initial |
| 347 // session snapshot containing data like initial_sync_ended. Important when | 348 // session snapshot containing data like initial_sync_ended. Important when |
| 348 // the client starts up and does not need to perform an initial sync. | 349 // the client starts up and does not need to perform an initial sync. |
| 349 void SendInitialSnapshot(); | 350 void SendInitialSnapshot(); |
| 350 | 351 |
| 352 virtual void OnActionableError(sessions::SyncSession* session); |
| 353 |
| 354 |
| 351 ScopedRunnableMethodFactory<SyncScheduler> method_factory_; | 355 ScopedRunnableMethodFactory<SyncScheduler> method_factory_; |
| 352 | 356 |
| 353 // Used for logging. | 357 // Used for logging. |
| 354 const std::string name_; | 358 const std::string name_; |
| 355 | 359 |
| 356 // The message loop this object is on. Almost all methods have to | 360 // The message loop this object is on. Almost all methods have to |
| 357 // be called on this thread. | 361 // be called on this thread. |
| 358 MessageLoop* const sync_loop_; | 362 MessageLoop* const sync_loop_; |
| 359 | 363 |
| 360 // Set in Start(), unset in Stop(). | 364 // Set in Start(), unset in Stop(). |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 scoped_ptr<Syncer> syncer_; | 397 scoped_ptr<Syncer> syncer_; |
| 394 | 398 |
| 395 scoped_ptr<sessions::SyncSessionContext> session_context_; | 399 scoped_ptr<sessions::SyncSessionContext> session_context_; |
| 396 | 400 |
| 397 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); | 401 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); |
| 398 }; | 402 }; |
| 399 | 403 |
| 400 } // namespace browser_sync | 404 } // namespace browser_sync |
| 401 | 405 |
| 402 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ | 406 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| OLD | NEW |