| 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> |
| 11 #include <IOKit/IOKitLib.h> | 11 #include <IOKit/IOKitLib.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include <algorithm> | 14 #include <algorithm> |
| 15 #include <map> | 15 #include <map> |
| 16 #include <queue> | 16 #include <queue> |
| 17 | 17 |
| 18 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
| 19 #include "base/stringprintf.h" | |
| 20 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 19 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 21 #include "chrome/browser/sync/engine/model_safe_worker.h" | 20 #include "chrome/browser/sync/engine/model_safe_worker.h" |
| 22 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 21 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
| 23 #include "chrome/browser/sync/engine/syncer.h" | 22 #include "chrome/browser/sync/engine/syncer.h" |
| 24 #include "chrome/browser/sync/sessions/session_state.h" | 23 #include "chrome/browser/sync/sessions/session_state.h" |
| 25 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 26 #include "jingle/notifier/listener/notification_constants.h" | 25 #include "jingle/notifier/listener/notification_constants.h" |
| 27 | 26 |
| 28 using std::priority_queue; | 27 using std::priority_queue; |
| 29 using std::min; | 28 using std::min; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 AutoLock lock(lock_); | 196 AutoLock lock(lock_); |
| 198 // Only valid to request a resume when we are already paused or we | 197 // Only valid to request a resume when we are already paused or we |
| 199 // have a pause pending. | 198 // have a pause pending. |
| 200 if (!(vault_.paused_ || vault_.pause_requested_)) | 199 if (!(vault_.paused_ || vault_.pause_requested_)) |
| 201 return false; | 200 return false; |
| 202 | 201 |
| 203 if (thread_.IsRunning()) { | 202 if (thread_.IsRunning()) { |
| 204 if (vault_.pause_requested_) { | 203 if (vault_.pause_requested_) { |
| 205 // If pause was requested we have not yet paused. In this case, | 204 // If pause was requested we have not yet paused. In this case, |
| 206 // the resume cancels the pause request. | 205 // the resume cancels the pause request. |
| 206 vault_.pause_requested_ = false; |
| 207 vault_field_changed_.Broadcast(); |
| 207 Notify(SyncEngineEvent::SYNCER_THREAD_RESUMED); | 208 Notify(SyncEngineEvent::SYNCER_THREAD_RESUMED); |
| 208 VLOG(1) << "Pending pause canceled by resume."; | 209 VLOG(1) << "Pending pause canceled by resume."; |
| 209 } else { | 210 } else { |
| 210 // Unpause and notify. | 211 // Unpause and notify. |
| 211 vault_.paused_ = false; | 212 vault_.paused_ = false; |
| 212 vault_field_changed_.Broadcast(); | 213 vault_field_changed_.Broadcast(); |
| 213 } | 214 } |
| 214 } else { | 215 } else { |
| 215 ExitPausedState(); | 216 ExitPausedState(); |
| 216 VLOG(1) << "Resumed while not running."; | 217 VLOG(1) << "Resumed while not running."; |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 was_logged = true; | 796 was_logged = true; |
| 796 VLOG(1) << "UserIdleTime unimplemented on this platform, synchronization " | 797 VLOG(1) << "UserIdleTime unimplemented on this platform, synchronization " |
| 797 "will not throttle when user idle"; | 798 "will not throttle when user idle"; |
| 798 } | 799 } |
| 799 #endif | 800 #endif |
| 800 | 801 |
| 801 return 0; | 802 return 0; |
| 802 } | 803 } |
| 803 | 804 |
| 804 } // namespace browser_sync | 805 } // namespace browser_sync |
| OLD | NEW |