| OLD | NEW |
| 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 SYNC_ENGINE_SYNC_SCHEDULER_H_ | 6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| 7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_ | 7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| 8 #pragma once | 8 #pragma once |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "sync/internal_api/public/util/weak_handle.h" | 26 #include "sync/internal_api/public/util/weak_handle.h" |
| 27 #include "sync/sessions/sync_session.h" | 27 #include "sync/sessions/sync_session.h" |
| 28 #include "sync/sessions/sync_session_context.h" | 28 #include "sync/sessions/sync_session_context.h" |
| 29 | 29 |
| 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 csync { | 36 namespace syncer { |
| 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: | 41 public: |
| 42 enum Mode { | 42 enum Mode { |
| 43 // In this mode, the thread only performs configuration tasks. This is | 43 // In this mode, the thread only performs configuration tasks. This is |
| 44 // 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 |
| 45 // 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 |
| 46 // normal mode. | 46 // normal mode. |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 // Executes the pending job. Called whenever an event occurs that may | 323 // Executes the pending job. Called whenever an event occurs that may |
| 324 // change conditions permitting a job to run. Like when network connection is | 324 // change conditions permitting a job to run. Like when network connection is |
| 325 // re-established, mode changes etc. | 325 // re-established, mode changes etc. |
| 326 void DoPendingJobIfPossible(bool is_canary_job); | 326 void DoPendingJobIfPossible(bool is_canary_job); |
| 327 | 327 |
| 328 // Called when the root cause of the current connection error is fixed. | 328 // Called when the root cause of the current connection error is fixed. |
| 329 void OnServerConnectionErrorFixed(); | 329 void OnServerConnectionErrorFixed(); |
| 330 | 330 |
| 331 // The pointer is owned by the caller. | 331 // The pointer is owned by the caller. |
| 332 csync::sessions::SyncSession* CreateSyncSession( | 332 syncer::sessions::SyncSession* CreateSyncSession( |
| 333 const csync::sessions::SyncSourceInfo& info); | 333 const syncer::sessions::SyncSourceInfo& info); |
| 334 | 334 |
| 335 // Creates a session for a poll and performs the sync. | 335 // Creates a session for a poll and performs the sync. |
| 336 void PollTimerCallback(); | 336 void PollTimerCallback(); |
| 337 | 337 |
| 338 // Used to update |connection_code_|, see below. | 338 // Used to update |connection_code_|, see below. |
| 339 void UpdateServerConnectionManagerStatus( | 339 void UpdateServerConnectionManagerStatus( |
| 340 HttpResponse::ServerConnectionCode code); | 340 HttpResponse::ServerConnectionCode code); |
| 341 | 341 |
| 342 // Called once the first time thread_ is started to broadcast an initial | 342 // Called once the first time thread_ is started to broadcast an initial |
| 343 // session snapshot containing data like initial_sync_ended. Important when | 343 // session snapshot containing data like initial_sync_ended. Important when |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 scoped_ptr<DelayProvider> delay_provider_; | 395 scoped_ptr<DelayProvider> delay_provider_; |
| 396 | 396 |
| 397 // Invoked to run through the sync cycle. | 397 // Invoked to run through the sync cycle. |
| 398 scoped_ptr<Syncer> syncer_; | 398 scoped_ptr<Syncer> syncer_; |
| 399 | 399 |
| 400 sessions::SyncSessionContext *session_context_; | 400 sessions::SyncSessionContext *session_context_; |
| 401 | 401 |
| 402 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); | 402 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); |
| 403 }; | 403 }; |
| 404 | 404 |
| 405 } // namespace csync | 405 } // namespace syncer |
| 406 | 406 |
| 407 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ | 407 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| OLD | NEW |