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

Side by Side Diff: chrome/browser/sync/engine/model_safe_worker.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 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/model_safe_worker.h" 5 #include "chrome/browser/sync/engine/model_safe_worker.h"
6 #include "chrome/browser/sync/sessions/unrecoverable_error_info.h"
6 7
7 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
8 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 10 #include "base/values.h"
10 11
11 namespace browser_sync { 12 namespace browser_sync {
12 13
14 using sessions::UnrecoverableErrorInfo;
15
13 base::DictionaryValue* ModelSafeRoutingInfoToValue( 16 base::DictionaryValue* ModelSafeRoutingInfoToValue(
14 const ModelSafeRoutingInfo& routing_info) { 17 const ModelSafeRoutingInfo& routing_info) {
15 base::DictionaryValue* dict = new base::DictionaryValue(); 18 base::DictionaryValue* dict = new base::DictionaryValue();
16 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); 19 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin();
17 it != routing_info.end(); ++it) { 20 it != routing_info.end(); ++it) {
18 dict->SetString(syncable::ModelTypeToString(it->first), 21 dict->SetString(syncable::ModelTypeToString(it->first),
19 ModelSafeGroupToString(it->second)); 22 ModelSafeGroupToString(it->second));
20 } 23 }
21 return dict; 24 return dict;
22 } 25 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 default: 70 default:
68 NOTREACHED(); 71 NOTREACHED();
69 return "INVALID"; 72 return "INVALID";
70 } 73 }
71 } 74 }
72 75
73 ModelSafeWorker::ModelSafeWorker() {} 76 ModelSafeWorker::ModelSafeWorker() {}
74 77
75 ModelSafeWorker::~ModelSafeWorker() {} 78 ModelSafeWorker::~ModelSafeWorker() {}
76 79
77 void ModelSafeWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) { 80 UnrecoverableErrorInfo ModelSafeWorker::DoWorkAndWaitUntilDone(
78 work->Run(); // For GROUP_PASSIVE, we do the work on the current thread. 81 Callback1<UnrecoverableErrorInfo*>::Type* work) {
82 UnrecoverableErrorInfo error_info;
83 work->Run(&error_info); // For GROUP_PASSIVE,
akalin 2011/10/25 03:20:06 put this as a single-line comment above this line
lipalani1 2011/10/26 00:12:13 Done.
84 // we do the work on the current thread.
85 return error_info;
79 } 86 }
80 87
81 ModelSafeGroup ModelSafeWorker::GetModelSafeGroup() { 88 ModelSafeGroup ModelSafeWorker::GetModelSafeGroup() {
82 return GROUP_PASSIVE; 89 return GROUP_PASSIVE;
83 } 90 }
84 91
85 } // namespace browser_sync 92 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698