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/sessions/directory_type_debug_info_emitter.h" | 5 #include "components/sync/sessions_impl/directory_type_debug_info_emitter.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "sync/internal_api/public/sessions/status_counters.h" | 11 #include "components/sync/sessions/status_counters.h" |
12 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" | 12 #include "components/sync/sessions/type_debug_info_observer.h" |
13 #include "sync/syncable/entry.h" | 13 #include "components/sync/syncable/entry.h" |
14 #include "sync/syncable/syncable_read_transaction.h" | 14 #include "components/sync/syncable/syncable_read_transaction.h" |
15 | 15 |
16 namespace syncer { | 16 namespace syncer { |
17 | 17 |
18 DirectoryTypeDebugInfoEmitter::DirectoryTypeDebugInfoEmitter( | 18 DirectoryTypeDebugInfoEmitter::DirectoryTypeDebugInfoEmitter( |
19 syncable::Directory* directory, | 19 syncable::Directory* directory, |
20 syncer::ModelType type, | 20 syncer::ModelType type, |
21 base::ObserverList<TypeDebugInfoObserver>* observers) | 21 base::ObserverList<TypeDebugInfoObserver>* observers) |
22 : directory_(directory), | 22 : directory_(directory), |
23 type_(type), | 23 type_(type), |
24 type_debug_info_observers_(observers) { | 24 type_debug_info_observers_(observers) {} |
25 } | |
26 | 25 |
27 DirectoryTypeDebugInfoEmitter::DirectoryTypeDebugInfoEmitter( | 26 DirectoryTypeDebugInfoEmitter::DirectoryTypeDebugInfoEmitter( |
28 ModelType type, | 27 ModelType type, |
29 base::ObserverList<TypeDebugInfoObserver>* observers) | 28 base::ObserverList<TypeDebugInfoObserver>* observers) |
30 : directory_(NULL), type_(type), type_debug_info_observers_(observers) { | 29 : directory_(NULL), type_(type), type_debug_info_observers_(observers) {} |
31 } | |
32 | 30 |
33 DirectoryTypeDebugInfoEmitter::~DirectoryTypeDebugInfoEmitter() {} | 31 DirectoryTypeDebugInfoEmitter::~DirectoryTypeDebugInfoEmitter() {} |
34 | 32 |
35 std::unique_ptr<base::ListValue> DirectoryTypeDebugInfoEmitter::GetAllNodes() { | 33 std::unique_ptr<base::ListValue> DirectoryTypeDebugInfoEmitter::GetAllNodes() { |
36 syncable::ReadTransaction trans(FROM_HERE, directory_); | 34 syncable::ReadTransaction trans(FROM_HERE, directory_); |
37 std::unique_ptr<base::ListValue> nodes( | 35 std::unique_ptr<base::ListValue> nodes( |
38 directory_->GetNodeDetailsForType(&trans, type_)); | 36 directory_->GetNodeDetailsForType(&trans, type_)); |
39 return nodes; | 37 return nodes; |
40 } | 38 } |
41 | 39 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (!e.GetIsDel()) { | 81 if (!e.GetIsDel()) { |
84 counters.num_entries++; | 82 counters.num_entries++; |
85 } | 83 } |
86 } | 84 } |
87 | 85 |
88 FOR_EACH_OBSERVER(TypeDebugInfoObserver, (*type_debug_info_observers_), | 86 FOR_EACH_OBSERVER(TypeDebugInfoObserver, (*type_debug_info_observers_), |
89 OnStatusCountersUpdated(type_, counters)); | 87 OnStatusCountersUpdated(type_, counters)); |
90 } | 88 } |
91 | 89 |
92 } // namespace syncer | 90 } // namespace syncer |
OLD | NEW |