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

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

Issue 10698141: Revert 145993 - [Sync] Add location parameter to SyncChange in Sync API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const syncer::BaseTransaction* trans, 42 const syncer::BaseTransaction* trans,
43 const syncer::ImmutableChangeRecordList& changes) { 43 const syncer::ImmutableChangeRecordList& changes) {
44 DCHECK(CalledOnValidThread()); 44 DCHECK(CalledOnValidThread());
45 DCHECK(running()); 45 DCHECK(running());
46 DCHECK(syncer_changes_.empty()); 46 DCHECK(syncer_changes_.empty());
47 for (syncer::ChangeRecordList::const_iterator it = 47 for (syncer::ChangeRecordList::const_iterator it =
48 changes.Get().begin(); it != changes.Get().end(); ++it) { 48 changes.Get().begin(); it != changes.Get().end(); ++it) {
49 if (it->action == syncer::ChangeRecord::ACTION_DELETE) { 49 if (it->action == syncer::ChangeRecord::ACTION_DELETE) {
50 syncer_changes_.push_back( 50 syncer_changes_.push_back(
51 syncer::SyncChange( 51 syncer::SyncChange(
52 FROM_HERE,
53 syncer::SyncChange::ACTION_DELETE, 52 syncer::SyncChange::ACTION_DELETE,
54 syncer::SyncData::CreateRemoteData(it->id, it->specifics))); 53 syncer::SyncData::CreateRemoteData(it->id, it->specifics)));
55 } else { 54 } else {
56 syncer::SyncChange::SyncChangeType action = 55 syncer::SyncChange::SyncChangeType action =
57 (it->action == syncer::ChangeRecord::ACTION_ADD) ? 56 (it->action == syncer::ChangeRecord::ACTION_ADD) ?
58 syncer::SyncChange::ACTION_ADD : syncer::SyncChange::ACTION_UPDATE; 57 syncer::SyncChange::ACTION_ADD : syncer::SyncChange::ACTION_UPDATE;
59 // Need to load specifics from node. 58 // Need to load specifics from node.
60 syncer::ReadNode read_node(trans); 59 syncer::ReadNode read_node(trans);
61 if (read_node.InitByIdLookup(it->id) != syncer::BaseNode::INIT_OK) { 60 if (read_node.InitByIdLookup(it->id) != syncer::BaseNode::INIT_OK) {
62 error_handler()->OnSingleDatatypeUnrecoverableError( 61 error_handler()->OnSingleDatatypeUnrecoverableError(
63 FROM_HERE, 62 FROM_HERE,
64 "Failed to look up data for received change with id " + 63 "Failed to look up data for received change with id " +
65 base::Int64ToString(it->id)); 64 base::Int64ToString(it->id));
66 return; 65 return;
67 } 66 }
68 syncer_changes_.push_back( 67 syncer_changes_.push_back(
69 syncer::SyncChange( 68 syncer::SyncChange(action,
70 FROM_HERE, 69 syncer::SyncData::CreateRemoteData(
71 action, 70 it->id, read_node.GetEntitySpecifics())));
72 syncer::SyncData::CreateRemoteData(
73 it->id, read_node.GetEntitySpecifics())));
74 } 71 }
75 } 72 }
76 } 73 }
77 74
78 void GenericChangeProcessor::CommitChangesFromSyncModel() { 75 void GenericChangeProcessor::CommitChangesFromSyncModel() {
79 DCHECK(CalledOnValidThread()); 76 DCHECK(CalledOnValidThread());
80 if (!running()) 77 if (!running())
81 return; 78 return;
82 if (syncer_changes_.empty()) 79 if (syncer_changes_.empty())
83 return; 80 return;
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 void GenericChangeProcessor::StopImpl() { 477 void GenericChangeProcessor::StopImpl() {
481 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 478 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
482 } 479 }
483 480
484 syncer::UserShare* GenericChangeProcessor::share_handle() const { 481 syncer::UserShare* GenericChangeProcessor::share_handle() const {
485 DCHECK(CalledOnValidThread()); 482 DCHECK(CalledOnValidThread());
486 return share_handle_; 483 return share_handle_;
487 } 484 }
488 485
489 } // namespace browser_sync 486 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698