OLD | NEW |
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 #include "chrome/browser/sync/engine/syncer_thread.h" | 4 #include "chrome/browser/sync/engine/syncer_thread.h" |
5 | 5 |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 | 7 |
8 #if defined(OS_MACOSX) | 8 #if defined(OS_MACOSX) |
9 #include <CoreFoundation/CFNumber.h> | 9 #include <CoreFoundation/CFNumber.h> |
10 #include <IOKit/IOTypes.h> | 10 #include <IOKit/IOTypes.h> |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 return_interval.poll_delta = silenced_until_ - TimeTicks::Now(); | 465 return_interval.poll_delta = silenced_until_ - TimeTicks::Now(); |
466 return return_interval; | 466 return return_interval; |
467 } | 467 } |
468 | 468 |
469 bool is_continuing_sync_cyle = *continue_sync_cycle; | 469 bool is_continuing_sync_cyle = *continue_sync_cycle; |
470 *continue_sync_cycle = false; | 470 *continue_sync_cycle = false; |
471 | 471 |
472 // Determine if the syncer has unfinished work to do. | 472 // Determine if the syncer has unfinished work to do. |
473 SyncSessionSnapshot* snapshot = session_context_->previous_session_snapshot(); | 473 SyncSessionSnapshot* snapshot = session_context_->previous_session_snapshot(); |
474 const bool syncer_has_work_to_do = snapshot && | 474 const bool syncer_has_work_to_do = snapshot && |
475 (snapshot->num_server_changes_remaining > snapshot->max_local_timestamp || | 475 (snapshot->num_server_changes_remaining > 0 || |
476 snapshot->unsynced_count > 0); | 476 snapshot->unsynced_count > 0); |
477 VLOG(1) << "syncer_has_work_to_do is " << syncer_has_work_to_do; | 477 VLOG(1) << "syncer_has_work_to_do is " << syncer_has_work_to_do; |
478 | 478 |
479 // First calculate the expected wait time, figuring in any backoff because of | 479 // First calculate the expected wait time, figuring in any backoff because of |
480 // user idle time. next_wait is in seconds | 480 // user idle time. next_wait is in seconds |
481 syncer_polling_interval_ = (!session_context_->notifications_enabled()) ? | 481 syncer_polling_interval_ = (!session_context_->notifications_enabled()) ? |
482 syncer_short_poll_interval_seconds_ : | 482 syncer_short_poll_interval_seconds_ : |
483 syncer_long_poll_interval_seconds_; | 483 syncer_long_poll_interval_seconds_; |
484 int default_next_wait = syncer_polling_interval_; | 484 int default_next_wait = syncer_polling_interval_; |
485 return_interval.poll_delta = TimeDelta::FromSeconds(default_next_wait); | 485 return_interval.poll_delta = TimeDelta::FromSeconds(default_next_wait); |
486 | 486 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 was_logged = true; | 843 was_logged = true; |
844 VLOG(1) << "UserIdleTime unimplemented on this platform, synchronization " | 844 VLOG(1) << "UserIdleTime unimplemented on this platform, synchronization " |
845 "will not throttle when user idle"; | 845 "will not throttle when user idle"; |
846 } | 846 } |
847 #endif | 847 #endif |
848 | 848 |
849 return 0; | 849 return 0; |
850 } | 850 } |
851 | 851 |
852 } // namespace browser_sync | 852 } // namespace browser_sync |
OLD | NEW |