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

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

Issue 11827013: sync: speculative fix for bug 165561 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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) 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_impl.h" 5 #include "sync/engine/sync_scheduler_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 309 }
310 310
311 } // namespace. 311 } // namespace.
312 312
313 bool SyncSchedulerImpl::ScheduleConfiguration( 313 bool SyncSchedulerImpl::ScheduleConfiguration(
314 const ConfigurationParams& params) { 314 const ConfigurationParams& params) {
315 DCHECK_EQ(MessageLoop::current(), sync_loop_); 315 DCHECK_EQ(MessageLoop::current(), sync_loop_);
316 DCHECK(IsConfigRelatedUpdateSourceValue(params.source)); 316 DCHECK(IsConfigRelatedUpdateSourceValue(params.source));
317 DCHECK_EQ(CONFIGURATION_MODE, mode_); 317 DCHECK_EQ(CONFIGURATION_MODE, mode_);
318 DCHECK(!params.ready_task.is_null()); 318 DCHECK(!params.ready_task.is_null());
319 CHECK(started_) << "Scheduler must be running to configure.";
319 SDVLOG(2) << "Reconfiguring syncer."; 320 SDVLOG(2) << "Reconfiguring syncer.";
320 321
321 // Only one configuration is allowed at a time. Verify we're not waiting 322 // Only one configuration is allowed at a time. Verify we're not waiting
322 // for a pending configure job. 323 // for a pending configure job.
323 DCHECK(!wait_interval_.get() || !wait_interval_->pending_configure_job); 324 DCHECK(!wait_interval_.get() || !wait_interval_->pending_configure_job);
324 325
325 ModelSafeRoutingInfo restricted_routes; 326 ModelSafeRoutingInfo restricted_routes;
326 BuildModelSafeParams(params.types_to_download, 327 BuildModelSafeParams(params.types_to_download,
327 params.routing_info, 328 params.routing_info,
328 &restricted_routes); 329 &restricted_routes);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 588 }
588 589
589 void SyncSchedulerImpl::ScheduleNudgeImpl( 590 void SyncSchedulerImpl::ScheduleNudgeImpl(
590 const TimeDelta& delay, 591 const TimeDelta& delay,
591 GetUpdatesCallerInfo::GetUpdatesSource source, 592 GetUpdatesCallerInfo::GetUpdatesSource source,
592 const ModelTypeInvalidationMap& invalidation_map, 593 const ModelTypeInvalidationMap& invalidation_map,
593 const tracked_objects::Location& nudge_location) { 594 const tracked_objects::Location& nudge_location) {
594 DCHECK_EQ(MessageLoop::current(), sync_loop_); 595 DCHECK_EQ(MessageLoop::current(), sync_loop_);
595 DCHECK(!invalidation_map.empty()) << "Nudge scheduled for no types!"; 596 DCHECK(!invalidation_map.empty()) << "Nudge scheduled for no types!";
596 597
598 if (!started_) {
599 SDVLOG_LOC(nudge_location, 2)
600 << "Dropping nudge, scheduler is not running.";
601 return;
602 }
603
597 SDVLOG_LOC(nudge_location, 2) 604 SDVLOG_LOC(nudge_location, 2)
598 << "In ScheduleNudgeImpl with delay " 605 << "In ScheduleNudgeImpl with delay "
599 << delay.InMilliseconds() << " ms, " 606 << delay.InMilliseconds() << " ms, "
600 << "source " << GetUpdatesSourceString(source) << ", " 607 << "source " << GetUpdatesSourceString(source) << ", "
601 << "payloads " 608 << "payloads "
602 << ModelTypeInvalidationMapToString(invalidation_map); 609 << ModelTypeInvalidationMapToString(invalidation_map);
603 610
604 SyncSourceInfo info(source, invalidation_map); 611 SyncSourceInfo info(source, invalidation_map);
605 UpdateNudgeTimeRecords(info); 612 UpdateNudgeTimeRecords(info);
606 613
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 } 992 }
986 993
987 void SyncSchedulerImpl::StopImpl(const base::Closure& callback) { 994 void SyncSchedulerImpl::StopImpl(const base::Closure& callback) {
988 DCHECK_EQ(MessageLoop::current(), sync_loop_); 995 DCHECK_EQ(MessageLoop::current(), sync_loop_);
989 SDVLOG(2) << "StopImpl called"; 996 SDVLOG(2) << "StopImpl called";
990 997
991 // Kill any in-flight method calls. 998 // Kill any in-flight method calls.
992 weak_ptr_factory_.InvalidateWeakPtrs(); 999 weak_ptr_factory_.InvalidateWeakPtrs();
993 wait_interval_.reset(); 1000 wait_interval_.reset();
994 poll_timer_.Stop(); 1001 poll_timer_.Stop();
1002 unscheduled_nudge_storage_.reset();
1003 pending_nudge_ = NULL;
995 if (started_) { 1004 if (started_) {
996 started_ = false; 1005 started_ = false;
997 } 1006 }
998 if (!callback.is_null()) 1007 if (!callback.is_null())
999 callback.Run(); 1008 callback.Run();
1000 } 1009 }
1001 1010
1002 void SyncSchedulerImpl::DoCanaryJob(scoped_ptr<SyncSessionJob> to_be_canary) { 1011 void SyncSchedulerImpl::DoCanaryJob(scoped_ptr<SyncSessionJob> to_be_canary) {
1003 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1012 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1004 SDVLOG(2) << "Do canary job"; 1013 SDVLOG(2) << "Do canary job";
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 1184
1176 #undef SDVLOG_LOC 1185 #undef SDVLOG_LOC
1177 1186
1178 #undef SDVLOG 1187 #undef SDVLOG
1179 1188
1180 #undef SLOG 1189 #undef SLOG
1181 1190
1182 #undef ENUM_CASE 1191 #undef ENUM_CASE
1183 1192
1184 } // namespace syncer 1193 } // namespace syncer
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