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

Side by Side Diff: components/reading_list/ios/reading_list_store.cc

Issue 2618483003: [Sync] Introduce ModelError for USS error handling. (Closed)
Patch Set: Fix iOS reading list. Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/reading_list/ios/reading_list_store.h" 5 #include "components/reading_list/ios/reading_list_store.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "components/reading_list/ios/proto/reading_list.pb.h" 10 #include "components/reading_list/ios/proto/reading_list.pb.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 batch_->TransferMetadataChanges(std::move(metadata_change_list)); 113 batch_->TransferMetadataChanges(std::move(metadata_change_list));
114 } 114 }
115 115
116 void ReadingListStore::OnDatabaseLoad( 116 void ReadingListStore::OnDatabaseLoad(
117 syncer::ModelTypeStore::Result result, 117 syncer::ModelTypeStore::Result result,
118 std::unique_ptr<syncer::ModelTypeStore::RecordList> entries) { 118 std::unique_ptr<syncer::ModelTypeStore::RecordList> entries) {
119 DCHECK(CalledOnValidThread()); 119 DCHECK(CalledOnValidThread());
120 if (result != syncer::ModelTypeStore::Result::SUCCESS) { 120 if (result != syncer::ModelTypeStore::Result::SUCCESS) {
121 change_processor()->OnMetadataLoaded( 121 change_processor()->OnMetadataLoaded(
122 change_processor()->CreateAndUploadError( 122 change_processor()->CreateAndUploadError(
123 FROM_HERE, "Cannot load Reading List Database."), 123 FROM_HERE, "Cannot load Reading List Database.", type()),
124 nullptr); 124 nullptr);
125 return; 125 return;
126 } 126 }
127 auto loaded_entries = 127 auto loaded_entries =
128 base::MakeUnique<ReadingListStoreDelegate::ReadingListEntries>(); 128 base::MakeUnique<ReadingListStoreDelegate::ReadingListEntries>();
129 129
130 for (const syncer::ModelTypeStore::Record& r : *entries.get()) { 130 for (const syncer::ModelTypeStore::Record& r : *entries.get()) {
131 reading_list::ReadingListLocal proto; 131 reading_list::ReadingListLocal proto;
132 if (!proto.ParseFromString(r.value)) { 132 if (!proto.ParseFromString(r.value)) {
133 continue; 133 continue;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if (rhs.first_read_time_us() == 0 && lhs.first_read_time_us() != 0) { 442 if (rhs.first_read_time_us() == 0 && lhs.first_read_time_us() != 0) {
443 return false; 443 return false;
444 } 444 }
445 if (rhs.first_read_time_us() > lhs.first_read_time_us() && 445 if (rhs.first_read_time_us() > lhs.first_read_time_us() &&
446 lhs.first_read_time_us() != 0) { 446 lhs.first_read_time_us() != 0) {
447 return false; 447 return false;
448 } 448 }
449 } 449 }
450 return true; 450 return true;
451 } 451 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698