Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: chrome/browser/sync/engine/syncapi.cc

Issue 7558015: [Sync] Set session sync commit delay to 10s (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/sync/engine/syncapi.h" 5 #include "chrome/browser/sync/engine/syncapi.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <bitset> 8 #include <bitset>
9 #include <iomanip> 9 #include <iomanip>
10 #include <list> 10 #include <list>
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 // SyncManager's implementation: SyncManager::SyncInternal 1216 // SyncManager's implementation: SyncManager::SyncInternal
1217 class SyncManager::SyncInternal 1217 class SyncManager::SyncInternal
1218 : public net::NetworkChangeNotifier::IPAddressObserver, 1218 : public net::NetworkChangeNotifier::IPAddressObserver,
1219 public sync_notifier::SyncNotifierObserver, 1219 public sync_notifier::SyncNotifierObserver,
1220 public JsBackend, 1220 public JsBackend,
1221 public SyncEngineEventListener, 1221 public SyncEngineEventListener,
1222 public ServerConnectionEventListener, 1222 public ServerConnectionEventListener,
1223 public syncable::DirectoryChangeDelegate { 1223 public syncable::DirectoryChangeDelegate {
1224 static const int kDefaultNudgeDelayMilliseconds; 1224 static const int kDefaultNudgeDelayMilliseconds;
1225 static const int kPreferencesNudgeDelayMilliseconds; 1225 static const int kPreferencesNudgeDelayMilliseconds;
1226 // TODO(akalin): Remove this once we have the delay controllable
1227 // from the server.
1228 static const int kSessionsNudgeDelayMilliseconds;
1226 public: 1229 public:
1227 explicit SyncInternal(const std::string& name) 1230 explicit SyncInternal(const std::string& name)
1228 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 1231 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
1229 registrar_(NULL), 1232 registrar_(NULL),
1230 initialized_(false), 1233 initialized_(false),
1231 setup_for_test_mode_(false), 1234 setup_for_test_mode_(false),
1232 observing_ip_address_changes_(false) { 1235 observing_ip_address_changes_(false) {
1233 // Pre-fill |notification_info_map_|. 1236 // Pre-fill |notification_info_map_|.
1234 for (int i = syncable::FIRST_REAL_MODEL_TYPE; 1237 for (int i = syncable::FIRST_REAL_MODEL_TYPE;
1235 i < syncable::MODEL_TYPE_COUNT; ++i) { 1238 i < syncable::MODEL_TYPE_COUNT; ++i) {
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 NotificationInfoMap notification_info_map_; 1631 NotificationInfoMap notification_info_map_;
1629 1632
1630 // These are for interacting with chrome://sync-internals. 1633 // These are for interacting with chrome://sync-internals.
1631 JsMessageHandlerMap js_message_handlers_; 1634 JsMessageHandlerMap js_message_handlers_;
1632 WeakHandle<JsEventHandler> js_event_handler_; 1635 WeakHandle<JsEventHandler> js_event_handler_;
1633 JsSyncManagerObserver js_sync_manager_observer_; 1636 JsSyncManagerObserver js_sync_manager_observer_;
1634 JsTransactionObserver js_transaction_observer_; 1637 JsTransactionObserver js_transaction_observer_;
1635 }; 1638 };
1636 const int SyncManager::SyncInternal::kDefaultNudgeDelayMilliseconds = 200; 1639 const int SyncManager::SyncInternal::kDefaultNudgeDelayMilliseconds = 200;
1637 const int SyncManager::SyncInternal::kPreferencesNudgeDelayMilliseconds = 2000; 1640 const int SyncManager::SyncInternal::kPreferencesNudgeDelayMilliseconds = 2000;
1641 const int SyncManager::SyncInternal::kSessionsNudgeDelayMilliseconds = 10000;
1638 1642
1639 SyncManager::Observer::~Observer() {} 1643 SyncManager::Observer::~Observer() {}
1640 1644
1641 SyncManager::SyncManager(const std::string& name) 1645 SyncManager::SyncManager(const std::string& name)
1642 : data_(new SyncInternal(name)) {} 1646 : data_(new SyncInternal(name)) {}
1643 1647
1644 SyncManager::Status::Status() 1648 SyncManager::Status::Status()
1645 : summary(INVALID), 1649 : summary(INVALID),
1646 authenticated(false), 1650 authenticated(false),
1647 server_up(false), 1651 server_up(false),
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 2458
2455 // Found real mutation. 2459 // Found real mutation.
2456 if (mutated_model_type == syncable::UNSPECIFIED) { 2460 if (mutated_model_type == syncable::UNSPECIFIED) {
2457 mutated_model_type = model_type; 2461 mutated_model_type = model_type;
2458 break; 2462 break;
2459 } 2463 }
2460 } 2464 }
2461 2465
2462 // Nudge if necessary. 2466 // Nudge if necessary.
2463 if (mutated_model_type != syncable::UNSPECIFIED) { 2467 if (mutated_model_type != syncable::UNSPECIFIED) {
2464 int nudge_delay = (mutated_model_type == syncable::PREFERENCES) ? 2468 int nudge_delay;
2465 kPreferencesNudgeDelayMilliseconds : kDefaultNudgeDelayMilliseconds; 2469 switch (mutated_model_type) {
2470 case syncable::PREFERENCES:
2471 nudge_delay = kPreferencesNudgeDelayMilliseconds;
2472 case syncable::SESSIONS:
2473 nudge_delay = kSessionsNudgeDelayMilliseconds;
2474 default:
2475 nudge_delay = kDefaultNudgeDelayMilliseconds;
2476 }
2466 syncable::ModelTypeBitSet model_types; 2477 syncable::ModelTypeBitSet model_types;
2467 model_types.set(mutated_model_type); 2478 model_types.set(mutated_model_type);
2468 if (weak_handle_this_.IsInitialized()) { 2479 if (weak_handle_this_.IsInitialized()) {
2469 weak_handle_this_.Call(FROM_HERE, 2480 weak_handle_this_.Call(FROM_HERE,
2470 &SyncInternal::RequestNudgeWithDataTypes, 2481 &SyncInternal::RequestNudgeWithDataTypes,
2471 TimeDelta::FromMilliseconds(nudge_delay), 2482 TimeDelta::FromMilliseconds(nudge_delay),
2472 browser_sync::NUDGE_SOURCE_LOCAL, 2483 browser_sync::NUDGE_SOURCE_LOCAL,
2473 model_types, 2484 model_types,
2474 FROM_HERE); 2485 FROM_HERE);
2475 } else { 2486 } else {
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
3063 void SyncManager::TriggerOnIncomingNotificationForTest( 3074 void SyncManager::TriggerOnIncomingNotificationForTest(
3064 const syncable::ModelTypeBitSet& model_types) { 3075 const syncable::ModelTypeBitSet& model_types) {
3065 syncable::ModelTypePayloadMap model_types_with_payloads = 3076 syncable::ModelTypePayloadMap model_types_with_payloads =
3066 syncable::ModelTypePayloadMapFromBitSet(model_types, 3077 syncable::ModelTypePayloadMapFromBitSet(model_types,
3067 std::string()); 3078 std::string());
3068 3079
3069 data_->OnIncomingNotification(model_types_with_payloads); 3080 data_->OnIncomingNotification(model_types_with_payloads);
3070 } 3081 }
3071 3082
3072 } // namespace sync_api 3083 } // namespace sync_api
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698