| 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 | 4 |
| 5 #include "chrome/browser/sync/engine/syncer_thread.h" | 5 #include "chrome/browser/sync/engine/syncer_thread.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // we want and allows stronger control over the poll rate from the server. We | 49 // we want and allows stronger control over the poll rate from the server. We |
| 50 // should probably re-visit this code later and figure out if user idle time | 50 // should probably re-visit this code later and figure out if user idle time |
| 51 // is really something we want and make sure it works, if it is. | 51 // is really something we want and make sure it works, if it is. |
| 52 const int SyncerThread::kDefaultMaxPollIntervalMs = 30 * 60 * 1000; | 52 const int SyncerThread::kDefaultMaxPollIntervalMs = 30 * 60 * 1000; |
| 53 | 53 |
| 54 // Backoff interval randomization factor. | 54 // Backoff interval randomization factor. |
| 55 static const int kBackoffRandomizationFactor = 2; | 55 static const int kBackoffRandomizationFactor = 2; |
| 56 | 56 |
| 57 const int SyncerThread::kMaxBackoffSeconds = 60 * 60 * 4; // 4 hours. | 57 const int SyncerThread::kMaxBackoffSeconds = 60 * 60 * 4; // 4 hours. |
| 58 | 58 |
| 59 SyncerThread::ProtectedFields::ProtectedFields() |
| 60 : stop_syncer_thread_(false), |
| 61 pause_requested_(false), |
| 62 paused_(false), |
| 63 syncer_(NULL), |
| 64 connected_(false), |
| 65 pending_nudge_source_(kUnknown) {} |
| 66 |
| 67 SyncerThread::ProtectedFields::~ProtectedFields() {} |
| 68 |
| 59 void SyncerThread::NudgeSyncerWithPayloads( | 69 void SyncerThread::NudgeSyncerWithPayloads( |
| 60 int milliseconds_from_now, | 70 int milliseconds_from_now, |
| 61 NudgeSource source, | 71 NudgeSource source, |
| 62 const TypePayloadMap& model_types_with_payloads) { | 72 const TypePayloadMap& model_types_with_payloads) { |
| 63 base::AutoLock lock(lock_); | 73 base::AutoLock lock(lock_); |
| 64 if (vault_.syncer_ == NULL) { | 74 if (vault_.syncer_ == NULL) { |
| 65 return; | 75 return; |
| 66 } | 76 } |
| 67 | 77 |
| 68 NudgeSyncImpl(milliseconds_from_now, source, model_types_with_payloads); | 78 NudgeSyncImpl(milliseconds_from_now, source, model_types_with_payloads); |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 was_logged = true; | 888 was_logged = true; |
| 879 VLOG(1) << "UserIdleTime unimplemented on this platform, synchronization " | 889 VLOG(1) << "UserIdleTime unimplemented on this platform, synchronization " |
| 880 "will not throttle when user idle"; | 890 "will not throttle when user idle"; |
| 881 } | 891 } |
| 882 #endif | 892 #endif |
| 883 | 893 |
| 884 return 0; | 894 return 0; |
| 885 } | 895 } |
| 886 | 896 |
| 887 } // namespace browser_sync | 897 } // namespace browser_sync |
| OLD | NEW |