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

Side by Side Diff: components/sync/model/recording_model_type_change_processor.cc

Issue 2961723003: [USS] Implement ApplySyncChanges and OnURLVisited/Modified/Deleted. (Closed)
Patch Set: handle nullptr case in bridge Created 3 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
« no previous file with comments | « components/sync/model/recording_model_type_change_processor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/sync/model/recording_model_type_change_processor.h" 5 #include "components/sync/model/recording_model_type_change_processor.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "components/sync/model/fake_model_type_sync_bridge.h"
11 #include "components/sync/model/metadata_batch.h" 12 #include "components/sync/model/metadata_batch.h"
12 13
13 namespace syncer { 14 namespace syncer {
14 15
15 namespace { 16 namespace {
16 17
17 std::unique_ptr<ModelTypeChangeProcessor> CreateAndAssignProcessor( 18 std::unique_ptr<ModelTypeChangeProcessor> CreateAndAssignProcessor(
18 RecordingModelTypeChangeProcessor** processor_address, 19 RecordingModelTypeChangeProcessor** processor_address,
19 bool expect_error, 20 bool expect_error,
20 ModelType type, 21 ModelType type,
(...skipping 19 matching lines...) Expand all
40 MetadataChangeList* metadata_changes) { 41 MetadataChangeList* metadata_changes) {
41 put_multimap_.insert(std::make_pair(storage_key, std::move(entity_data))); 42 put_multimap_.insert(std::make_pair(storage_key, std::move(entity_data)));
42 } 43 }
43 44
44 void RecordingModelTypeChangeProcessor::Delete( 45 void RecordingModelTypeChangeProcessor::Delete(
45 const std::string& storage_key, 46 const std::string& storage_key,
46 MetadataChangeList* metadata_changes) { 47 MetadataChangeList* metadata_changes) {
47 delete_set_.insert(storage_key); 48 delete_set_.insert(storage_key);
48 } 49 }
49 50
51 void RecordingModelTypeChangeProcessor::UpdateStorageKey(
52 const EntityData& entity_data,
53 const std::string& storage_key,
54 MetadataChangeList* metadata_change_list) {
55 update_multimap_.insert(std::make_pair(
56 storage_key, FakeModelTypeSyncBridge::CopyEntityData(entity_data)));
57 }
58
59 void RecordingModelTypeChangeProcessor::UntrackEntity(
60 const EntityData& entity_data) {
61 untrack_set_.insert(FakeModelTypeSyncBridge::CopyEntityData(entity_data));
62 }
63
50 void RecordingModelTypeChangeProcessor::ModelReadyToSync( 64 void RecordingModelTypeChangeProcessor::ModelReadyToSync(
51 std::unique_ptr<MetadataBatch> batch) { 65 std::unique_ptr<MetadataBatch> batch) {
52 std::swap(metadata_, batch); 66 std::swap(metadata_, batch);
53 } 67 }
54 68
55 bool RecordingModelTypeChangeProcessor::IsTrackingMetadata() { 69 bool RecordingModelTypeChangeProcessor::IsTrackingMetadata() {
56 return is_tracking_metadata_; 70 return is_tracking_metadata_;
57 } 71 }
58 72
59 void RecordingModelTypeChangeProcessor::SetIsTrackingMetadata( 73 void RecordingModelTypeChangeProcessor::SetIsTrackingMetadata(
60 bool is_tracking) { 74 bool is_tracking) {
61 is_tracking_metadata_ = is_tracking; 75 is_tracking_metadata_ = is_tracking;
62 } 76 }
63 77
64 // static 78 // static
65 ModelTypeSyncBridge::ChangeProcessorFactory 79 ModelTypeSyncBridge::ChangeProcessorFactory
66 RecordingModelTypeChangeProcessor::FactoryForBridgeTest( 80 RecordingModelTypeChangeProcessor::FactoryForBridgeTest(
67 RecordingModelTypeChangeProcessor** processor_address, 81 RecordingModelTypeChangeProcessor** processor_address,
68 bool expect_error) { 82 bool expect_error) {
69 return base::Bind(&CreateAndAssignProcessor, 83 return base::Bind(&CreateAndAssignProcessor,
70 base::Unretained(processor_address), expect_error); 84 base::Unretained(processor_address), expect_error);
71 } 85 }
72 86
73 } // namespace syncer 87 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/model/recording_model_type_change_processor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698