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

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

Issue 7621085: Server directed error handling backend code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. 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
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/sync_scheduler.h" 5 #include "chrome/browser/sync/engine/sync_scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 sessions_commit_delay_ = new_delay; 1077 sessions_commit_delay_ = new_delay;
1078 } 1078 }
1079 1079
1080 void SyncScheduler::OnShouldStopSyncingPermanently() { 1080 void SyncScheduler::OnShouldStopSyncingPermanently() {
1081 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1081 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1082 SVLOG(2) << "OnShouldStopSyncingPermanently"; 1082 SVLOG(2) << "OnShouldStopSyncingPermanently";
1083 syncer_->RequestEarlyExit(); // Thread-safe. 1083 syncer_->RequestEarlyExit(); // Thread-safe.
1084 Notify(SyncEngineEvent::STOP_SYNCING_PERMANENTLY); 1084 Notify(SyncEngineEvent::STOP_SYNCING_PERMANENTLY);
1085 } 1085 }
1086 1086
1087 void SyncScheduler::OnRequestEarlyExit() {
1088 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1089 SVLOG(2) << "OnRequestEarlyExit";
1090 syncer_->RequestEarlyExit(); // Thread-safe.
1091 }
1092
1093 void SyncScheduler::OnActionableError(sessions::SyncSession* session) {
1094 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1095 SVLOG(2) << "OnActionableError";
1096 SyncEngineEvent event(SyncEngineEvent::ACTIONABLE_ERROR);
1097 sessions::SyncSessionSnapshot snapshot(session->TakeSnapshot());
1098 event.snapshot = &snapshot;
1099 session->context()->NotifyListeners(event);
1100 }
1101
1102
1087 void SyncScheduler::OnServerConnectionEvent( 1103 void SyncScheduler::OnServerConnectionEvent(
1088 const ServerConnectionEvent& event) { 1104 const ServerConnectionEvent& event) {
1089 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1105 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1090 PostTask(FROM_HERE, "CheckServerConnectionManagerStatus", 1106 PostTask(FROM_HERE, "CheckServerConnectionManagerStatus",
1091 method_factory_.NewRunnableMethod( 1107 method_factory_.NewRunnableMethod(
1092 &SyncScheduler::CheckServerConnectionManagerStatus, 1108 &SyncScheduler::CheckServerConnectionManagerStatus,
1093 event.connection_code)); 1109 event.connection_code));
1094 } 1110 }
1095 1111
1096 void SyncScheduler::set_notifications_enabled(bool notifications_enabled) { 1112 void SyncScheduler::set_notifications_enabled(bool notifications_enabled) {
1097 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1113 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1098 session_context_->set_notifications_enabled(notifications_enabled); 1114 session_context_->set_notifications_enabled(notifications_enabled);
1099 } 1115 }
1100 1116
1101 base::TimeDelta SyncScheduler::sessions_commit_delay() const { 1117 base::TimeDelta SyncScheduler::sessions_commit_delay() const {
1102 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1118 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1103 return sessions_commit_delay_; 1119 return sessions_commit_delay_;
1104 } 1120 }
1105 1121
1106 #undef SVLOG_LOC 1122 #undef SVLOG_LOC
1107 1123
1108 #undef SVLOG 1124 #undef SVLOG
1109 1125
1110 #undef SLOG 1126 #undef SLOG
1111 1127
1112 #undef ENUM_CASE 1128 #undef ENUM_CASE
1113 1129
1114 } // browser_sync 1130 } // browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698