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

Side by Side Diff: sync/engine/sync_scheduler.cc

Issue 10454105: sync: Refactor per-datatype throttling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 8 years, 6 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 | « sync/engine/get_commit_ids_command.cc ('k') | sync/engine/sync_scheduler_unittest.cc » ('j') | 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) 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 #include "sync/engine/sync_scheduler.h" 5 #include "sync/engine/sync_scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/rand_util.h" 15 #include "base/rand_util.h"
16 #include "sync/engine/syncer.h" 16 #include "sync/engine/syncer.h"
17 #include "sync/engine/throttled_data_type_tracker.h"
17 #include "sync/protocol/proto_enum_conversions.h" 18 #include "sync/protocol/proto_enum_conversions.h"
18 #include "sync/protocol/sync.pb.h" 19 #include "sync/protocol/sync.pb.h"
19 #include "sync/util/data_type_histogram.h" 20 #include "sync/util/data_type_histogram.h"
20 #include "sync/util/logging.h" 21 #include "sync/util/logging.h"
21 22
22 using base::TimeDelta; 23 using base::TimeDelta;
23 using base::TimeTicks; 24 using base::TimeTicks;
24 25
25 namespace browser_sync { 26 namespace browser_sync {
26 27
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 332
332 SyncScheduler::JobProcessDecision SyncScheduler::DecideOnJob( 333 SyncScheduler::JobProcessDecision SyncScheduler::DecideOnJob(
333 const SyncSessionJob& job) { 334 const SyncSessionJob& job) {
334 DCHECK_EQ(MessageLoop::current(), sync_loop_); 335 DCHECK_EQ(MessageLoop::current(), sync_loop_);
335 if (job.purpose == SyncSessionJob::CLEAR_USER_DATA || 336 if (job.purpose == SyncSessionJob::CLEAR_USER_DATA ||
336 job.purpose == SyncSessionJob::CLEANUP_DISABLED_TYPES) 337 job.purpose == SyncSessionJob::CLEANUP_DISABLED_TYPES)
337 return CONTINUE; 338 return CONTINUE;
338 339
339 // See if our type is throttled. 340 // See if our type is throttled.
340 syncable::ModelTypeSet throttled_types = 341 syncable::ModelTypeSet throttled_types =
341 session_context_->GetThrottledTypes(); 342 session_context_->throttled_data_type_tracker()->GetThrottledTypes();
342 if (job.purpose == SyncSessionJob::NUDGE && 343 if (job.purpose == SyncSessionJob::NUDGE &&
343 job.session->source().updates_source == GetUpdatesCallerInfo::LOCAL) { 344 job.session->source().updates_source == GetUpdatesCallerInfo::LOCAL) {
344 syncable::ModelTypeSet requested_types; 345 syncable::ModelTypeSet requested_types;
345 for (ModelTypePayloadMap::const_iterator i = 346 for (ModelTypePayloadMap::const_iterator i =
346 job.session->source().types.begin(); 347 job.session->source().types.begin();
347 i != job.session->source().types.end(); 348 i != job.session->source().types.end();
348 ++i) { 349 ++i) {
349 requested_types.Put(i->first); 350 requested_types.Put(i->first);
350 } 351 }
351 352
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 1192
1192 #undef SDVLOG_LOC 1193 #undef SDVLOG_LOC
1193 1194
1194 #undef SDVLOG 1195 #undef SDVLOG
1195 1196
1196 #undef SLOG 1197 #undef SLOG
1197 1198
1198 #undef ENUM_CASE 1199 #undef ENUM_CASE
1199 1200
1200 } // browser_sync 1201 } // browser_sync
OLDNEW
« no previous file with comments | « sync/engine/get_commit_ids_command.cc ('k') | sync/engine/sync_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698