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

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

Issue 8366030: Introduce the plumbing necessary to report Unrecoverable error from model safe workers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For a high level review. Created 9 years, 2 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/bind.h" 10 #include "base/bind.h"
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 const sessions::SyncSessionSnapshot& snapshot) { 1158 const sessions::SyncSessionSnapshot& snapshot) {
1159 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1159 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1160 if (ShouldRequestEarlyExit(snapshot.errors.sync_protocol_error)) { 1160 if (ShouldRequestEarlyExit(snapshot.errors.sync_protocol_error)) {
1161 SVLOG(2) << "Sync Scheduler requesting early exit."; 1161 SVLOG(2) << "Sync Scheduler requesting early exit.";
1162 syncer_->RequestEarlyExit(); // Thread-safe. 1162 syncer_->RequestEarlyExit(); // Thread-safe.
1163 } 1163 }
1164 if (IsActionableError(snapshot.errors.sync_protocol_error)) 1164 if (IsActionableError(snapshot.errors.sync_protocol_error))
1165 OnActionableError(snapshot); 1165 OnActionableError(snapshot);
1166 } 1166 }
1167 1167
1168 void SyncScheduler::OnUnrecoverableError(
1169 const tracked_objects::Location& from_here,
1170 const std :: string& message) {
1171 syncer_->RequestEarlyExit();
1172 SyncEngineEvent event(from_here, message);
1173 session_context_->NotifyListeners(event);
1174 }
1168 1175
1169 void SyncScheduler::OnServerConnectionEvent( 1176 void SyncScheduler::OnServerConnectionEvent(
1170 const ServerConnectionEvent& event) { 1177 const ServerConnectionEvent& event) {
1171 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1178 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1172 PostTask(FROM_HERE, "CheckServerConnectionManagerStatus", 1179 PostTask(FROM_HERE, "CheckServerConnectionManagerStatus",
1173 base::Bind(&SyncScheduler::CheckServerConnectionManagerStatus, 1180 base::Bind(&SyncScheduler::CheckServerConnectionManagerStatus,
1174 weak_ptr_factory_.GetWeakPtr(), 1181 weak_ptr_factory_.GetWeakPtr(),
1175 event.connection_code)); 1182 event.connection_code));
1176 } 1183 }
1177 1184
1178 void SyncScheduler::set_notifications_enabled(bool notifications_enabled) { 1185 void SyncScheduler::set_notifications_enabled(bool notifications_enabled) {
1179 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1186 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1180 session_context_->set_notifications_enabled(notifications_enabled); 1187 session_context_->set_notifications_enabled(notifications_enabled);
1181 } 1188 }
1182 1189
1183 base::TimeDelta SyncScheduler::sessions_commit_delay() const { 1190 base::TimeDelta SyncScheduler::sessions_commit_delay() const {
1184 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1191 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1185 return sessions_commit_delay_; 1192 return sessions_commit_delay_;
1186 } 1193 }
1187 1194
1188 #undef SVLOG_LOC 1195 #undef SVLOG_LOC
1189 1196
1190 #undef SVLOG 1197 #undef SVLOG
1191 1198
1192 #undef SLOG 1199 #undef SLOG
1193 1200
1194 #undef ENUM_CASE 1201 #undef ENUM_CASE
1195 1202
1196 } // browser_sync 1203 } // browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698