OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/engine_impl/directory_update_handler.h" | 5 #include "components/sync/engine_impl/directory_update_handler.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | |
10 #include <vector> | 9 #include <vector> |
11 | 10 |
12 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
13 #include "components/sync/base/data_type_histogram.h" | 12 #include "components/sync/base/data_type_histogram.h" |
14 #include "components/sync/engine_impl/conflict_resolver.h" | 13 #include "components/sync/engine_impl/conflict_resolver.h" |
15 #include "components/sync/engine_impl/cycle/data_type_debug_info_emitter.h" | 14 #include "components/sync/engine_impl/cycle/data_type_debug_info_emitter.h" |
16 #include "components/sync/engine_impl/cycle/status_controller.h" | 15 #include "components/sync/engine_impl/cycle/status_controller.h" |
17 #include "components/sync/engine_impl/update_applicator.h" | 16 #include "components/sync/engine_impl/update_applicator.h" |
18 #include "components/sync/syncable/directory.h" | 17 #include "components/sync/syncable/directory.h" |
19 #include "components/sync/syncable/model_neutral_mutable_entry.h" | 18 #include "components/sync/syncable/model_neutral_mutable_entry.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 120 |
122 void DirectoryUpdateHandler::ApplyUpdates(StatusController* status) { | 121 void DirectoryUpdateHandler::ApplyUpdates(StatusController* status) { |
123 if (IsApplyUpdatesRequired()) { | 122 if (IsApplyUpdatesRequired()) { |
124 // This will invoke handlers that belong to the model and its thread, so we | 123 // This will invoke handlers that belong to the model and its thread, so we |
125 // switch to the appropriate thread before we start this work. | 124 // switch to the appropriate thread before we start this work. |
126 WorkCallback c = | 125 WorkCallback c = |
127 base::Bind(&DirectoryUpdateHandler::ApplyUpdatesImpl, | 126 base::Bind(&DirectoryUpdateHandler::ApplyUpdatesImpl, |
128 // We wait until the callback is executed. We can safely use | 127 // We wait until the callback is executed. We can safely use |
129 // Unretained. | 128 // Unretained. |
130 base::Unretained(this), base::Unretained(status)); | 129 base::Unretained(this), base::Unretained(status)); |
131 worker_->DoWorkAndWaitUntilDone(std::move(c)); | 130 worker_->DoWorkAndWaitUntilDone(c); |
132 | 131 |
133 debug_info_emitter_->EmitUpdateCountersUpdate(); | 132 debug_info_emitter_->EmitUpdateCountersUpdate(); |
134 debug_info_emitter_->EmitStatusCountersUpdate(); | 133 debug_info_emitter_->EmitStatusCountersUpdate(); |
135 } | 134 } |
136 | 135 |
137 PostApplyUpdates(); | 136 PostApplyUpdates(); |
138 } | 137 } |
139 | 138 |
140 void DirectoryUpdateHandler::PassiveApplyUpdates(StatusController* status) { | 139 void DirectoryUpdateHandler::PassiveApplyUpdates(StatusController* status) { |
141 if (IsApplyUpdatesRequired()) { | 140 if (IsApplyUpdatesRequired()) { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 new_gc_directive.version_watermark())) { | 304 new_gc_directive.version_watermark())) { |
306 ExpireEntriesByVersion(dir_, trans, type_, | 305 ExpireEntriesByVersion(dir_, trans, type_, |
307 new_gc_directive.version_watermark()); | 306 new_gc_directive.version_watermark()); |
308 } | 307 } |
309 | 308 |
310 cached_gc_directive_ = | 309 cached_gc_directive_ = |
311 base::MakeUnique<sync_pb::GarbageCollectionDirective>(new_gc_directive); | 310 base::MakeUnique<sync_pb::GarbageCollectionDirective>(new_gc_directive); |
312 } | 311 } |
313 | 312 |
314 } // namespace syncer | 313 } // namespace syncer |
OLD | NEW |