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 "sync/engine/directory_update_handler.h" | 5 #include "sync/engine/directory_update_handler.h" |
6 | 6 |
7 #include "sync/engine/conflict_resolver.h" | 7 #include "sync/engine/conflict_resolver.h" |
8 #include "sync/engine/process_updates_util.h" | 8 #include "sync/engine/process_updates_util.h" |
9 #include "sync/engine/update_applicator.h" | 9 #include "sync/engine/update_applicator.h" |
10 #include "sync/sessions/directory_type_debug_info_emitter.h" | 10 #include "sync/sessions/directory_type_debug_info_emitter.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // This will invoke handlers that belong to the model and its thread, so we | 83 // This will invoke handlers that belong to the model and its thread, so we |
84 // switch to the appropriate thread before we start this work. | 84 // switch to the appropriate thread before we start this work. |
85 WorkCallback c = base::Bind( | 85 WorkCallback c = base::Bind( |
86 &DirectoryUpdateHandler::ApplyUpdatesImpl, | 86 &DirectoryUpdateHandler::ApplyUpdatesImpl, |
87 // We wait until the callback is executed. We can safely use Unretained. | 87 // We wait until the callback is executed. We can safely use Unretained. |
88 base::Unretained(this), | 88 base::Unretained(this), |
89 base::Unretained(status)); | 89 base::Unretained(status)); |
90 worker_->DoWorkAndWaitUntilDone(c); | 90 worker_->DoWorkAndWaitUntilDone(c); |
91 | 91 |
92 debug_info_emitter_->EmitUpdateCountersUpdate(); | 92 debug_info_emitter_->EmitUpdateCountersUpdate(); |
| 93 debug_info_emitter_->EmitStatusCountersUpdate(); |
93 } | 94 } |
94 | 95 |
95 void DirectoryUpdateHandler::PassiveApplyUpdates( | 96 void DirectoryUpdateHandler::PassiveApplyUpdates( |
96 sessions::StatusController* status) { | 97 sessions::StatusController* status) { |
97 if (!IsApplyUpdatesRequired()) { | 98 if (!IsApplyUpdatesRequired()) { |
98 return; | 99 return; |
99 } | 100 } |
100 | 101 |
101 // Just do the work here instead of deferring to another thread. | 102 // Just do the work here instead of deferring to another thread. |
102 ApplyUpdatesImpl(status); | 103 ApplyUpdatesImpl(status); |
103 | 104 |
104 debug_info_emitter_->EmitUpdateCountersUpdate(); | 105 debug_info_emitter_->EmitUpdateCountersUpdate(); |
| 106 debug_info_emitter_->EmitStatusCountersUpdate(); |
105 } | 107 } |
106 | 108 |
107 SyncerError DirectoryUpdateHandler::ApplyUpdatesImpl( | 109 SyncerError DirectoryUpdateHandler::ApplyUpdatesImpl( |
108 sessions::StatusController* status) { | 110 sessions::StatusController* status) { |
109 syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir_); | 111 syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir_); |
110 | 112 |
111 std::vector<int64> handles; | 113 std::vector<int64> handles; |
112 dir_->GetUnappliedUpdateMetaHandles( | 114 dir_->GetUnappliedUpdateMetaHandles( |
113 &trans, | 115 &trans, |
114 FullModelTypeSet(type_), | 116 FullModelTypeSet(type_), |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 new_gc_directive.version_watermark())) { | 252 new_gc_directive.version_watermark())) { |
251 ExpireEntriesByVersion(dir_, trans, type_, | 253 ExpireEntriesByVersion(dir_, trans, type_, |
252 new_gc_directive.version_watermark()); | 254 new_gc_directive.version_watermark()); |
253 } | 255 } |
254 | 256 |
255 cached_gc_directive_.reset( | 257 cached_gc_directive_.reset( |
256 new sync_pb::GarbageCollectionDirective(new_gc_directive)); | 258 new sync_pb::GarbageCollectionDirective(new_gc_directive)); |
257 } | 259 } |
258 | 260 |
259 } // namespace syncer | 261 } // namespace syncer |
OLD | NEW |