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

Side by Side Diff: chrome/browser/sync/glue/generic_change_processor.cc

Issue 10553042: sync: don't make DataTypeErrorHandler inherit UnrecoverableErrorHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test 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
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 "chrome/browser/sync/glue/generic_change_processor.h" 5 #include "chrome/browser/sync/glue/generic_change_processor.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 syncer_changes_.push_back( 50 syncer_changes_.push_back(
51 SyncChange(SyncChange::ACTION_DELETE, 51 SyncChange(SyncChange::ACTION_DELETE,
52 SyncData::CreateRemoteData(it->id, it->specifics))); 52 SyncData::CreateRemoteData(it->id, it->specifics)));
53 } else { 53 } else {
54 SyncChange::SyncChangeType action = 54 SyncChange::SyncChangeType action =
55 (it->action == sync_api::ChangeRecord::ACTION_ADD) ? 55 (it->action == sync_api::ChangeRecord::ACTION_ADD) ?
56 SyncChange::ACTION_ADD : SyncChange::ACTION_UPDATE; 56 SyncChange::ACTION_ADD : SyncChange::ACTION_UPDATE;
57 // Need to load specifics from node. 57 // Need to load specifics from node.
58 sync_api::ReadNode read_node(trans); 58 sync_api::ReadNode read_node(trans);
59 if (read_node.InitByIdLookup(it->id) != sync_api::BaseNode::INIT_OK) { 59 if (read_node.InitByIdLookup(it->id) != sync_api::BaseNode::INIT_OK) {
60 error_handler()->OnUnrecoverableError( 60 error_handler()->OnSingleDatatypeUnrecoverableError(
61 FROM_HERE, 61 FROM_HERE,
62 "Failed to look up data for received change with id " + 62 "Failed to look up data for received change with id " +
63 base::Int64ToString(it->id)); 63 base::Int64ToString(it->id));
64 return; 64 return;
65 } 65 }
66 syncer_changes_.push_back( 66 syncer_changes_.push_back(
67 SyncChange(action, 67 SyncChange(action,
68 SyncData::CreateRemoteData( 68 SyncData::CreateRemoteData(
69 it->id, read_node.GetEntitySpecifics()))); 69 it->id, read_node.GetEntitySpecifics())));
70 } 70 }
71 } 71 }
72 } 72 }
73 73
74 void GenericChangeProcessor::CommitChangesFromSyncModel() { 74 void GenericChangeProcessor::CommitChangesFromSyncModel() {
75 DCHECK(CalledOnValidThread()); 75 DCHECK(CalledOnValidThread());
76 if (!running()) 76 if (!running())
77 return; 77 return;
78 if (syncer_changes_.empty()) 78 if (syncer_changes_.empty())
79 return; 79 return;
80 if (!local_service_) { 80 if (!local_service_) {
81 syncable::ModelType type = syncer_changes_[0].sync_data().GetDataType(); 81 syncable::ModelType type = syncer_changes_[0].sync_data().GetDataType();
82 SyncError error(FROM_HERE, "Local service destroyed.", type); 82 SyncError error(FROM_HERE, "Local service destroyed.", type);
83 error_handler()->OnUnrecoverableError(error.location(), error.message()); 83 error_handler()->OnSingleDatatypeUnrecoverableError(error.location(),
84 error.message());
84 return; 85 return;
85 } 86 }
86 SyncError error = local_service_->ProcessSyncChanges(FROM_HERE, 87 SyncError error = local_service_->ProcessSyncChanges(FROM_HERE,
87 syncer_changes_); 88 syncer_changes_);
88 syncer_changes_.clear(); 89 syncer_changes_.clear();
89 if (error.IsSet()) { 90 if (error.IsSet()) {
90 error_handler()->OnSingleDatatypeUnrecoverableError( 91 error_handler()->OnSingleDatatypeUnrecoverableError(
91 error.location(), error.message()); 92 error.location(), error.message());
92 } 93 }
93 } 94 }
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 void GenericChangeProcessor::StopImpl() { 472 void GenericChangeProcessor::StopImpl() {
472 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 473 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
473 } 474 }
474 475
475 sync_api::UserShare* GenericChangeProcessor::share_handle() const { 476 sync_api::UserShare* GenericChangeProcessor::share_handle() const {
476 DCHECK(CalledOnValidThread()); 477 DCHECK(CalledOnValidThread());
477 return share_handle_; 478 return share_handle_;
478 } 479 }
479 480
480 } // namespace browser_sync 481 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698