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