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

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

Issue 23129007: sync: Add GetAllSyncData to sync/api (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 7 years, 3 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/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 syncer::SyncError error = local_service_->ProcessSyncChanges(FROM_HERE, 130 syncer::SyncError error = local_service_->ProcessSyncChanges(FROM_HERE,
131 syncer_changes_); 131 syncer_changes_);
132 syncer_changes_.clear(); 132 syncer_changes_.clear();
133 if (error.IsSet()) { 133 if (error.IsSet()) {
134 error_handler()->OnSingleDatatypeUnrecoverableError( 134 error_handler()->OnSingleDatatypeUnrecoverableError(
135 error.location(), error.message()); 135 error.location(), error.message());
136 } 136 }
137 } 137 }
138 138
139 syncer::SyncError GenericChangeProcessor::GetSyncDataForType( 139 syncer::SyncDataList GenericChangeProcessor::GetAllSyncData(
140 syncer::ModelType type) const {
141 // This is slow / memory intensive. Should be used sparingly by datatypes.
142 syncer::SyncDataList data;
143 GetAllSyncDataReturnError(type, &data);
144 return data;
145 }
146
147 syncer::SyncError GenericChangeProcessor::GetAllSyncDataReturnError(
140 syncer::ModelType type, 148 syncer::ModelType type,
141 syncer::SyncDataList* current_sync_data) { 149 syncer::SyncDataList* current_sync_data) const {
142 DCHECK(CalledOnValidThread()); 150 DCHECK(CalledOnValidThread());
143 std::string type_name = syncer::ModelTypeToString(type); 151 std::string type_name = syncer::ModelTypeToString(type);
144 syncer::ReadTransaction trans(FROM_HERE, share_handle()); 152 syncer::ReadTransaction trans(FROM_HERE, share_handle());
145 syncer::ReadNode root(&trans); 153 syncer::ReadNode root(&trans);
146 if (root.InitByTagLookup(syncer::ModelTypeToRootTag(type)) != 154 if (root.InitByTagLookup(syncer::ModelTypeToRootTag(type)) !=
147 syncer::BaseNode::INIT_OK) { 155 syncer::BaseNode::INIT_OK) {
148 syncer::SyncError error(FROM_HERE, 156 syncer::SyncError error(FROM_HERE,
149 syncer::SyncError::DATATYPE_ERROR, 157 syncer::SyncError::DATATYPE_ERROR,
150 "Server did not create the top-level " + type_name + 158 "Server did not create the top-level " + type_name +
151 " node. We might be running against an out-of-" 159 " node. We might be running against an out-of-"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 void GenericChangeProcessor::StartImpl(Profile* profile) { 566 void GenericChangeProcessor::StartImpl(Profile* profile) {
559 DCHECK(CalledOnValidThread()); 567 DCHECK(CalledOnValidThread());
560 } 568 }
561 569
562 syncer::UserShare* GenericChangeProcessor::share_handle() const { 570 syncer::UserShare* GenericChangeProcessor::share_handle() const {
563 DCHECK(CalledOnValidThread()); 571 DCHECK(CalledOnValidThread());
564 return share_handle_; 572 return share_handle_;
565 } 573 }
566 574
567 } // namespace browser_sync 575 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/generic_change_processor.h ('k') | chrome/browser/sync/glue/generic_change_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698