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

Side by Side Diff: sync/syncable/directory.cc

Issue 224563004: sync: Re-implement getAllNodes WebUI function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « sync/syncable/directory.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/syncable/directory.h" 5 #include "sync/syncable/directory.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 for (MetahandlesMap::iterator it = kernel_->metahandles_map.begin(); 927 for (MetahandlesMap::iterator it = kernel_->metahandles_map.begin();
928 it != kernel_->metahandles_map.end(); ++it) { 928 it != kernel_->metahandles_map.end(); ++it) {
929 EntryKernel* entry = it->second; 929 EntryKernel* entry = it->second;
930 const ModelType type = GetModelTypeFromSpecifics(entry->ref(SPECIFICS)); 930 const ModelType type = GetModelTypeFromSpecifics(entry->ref(SPECIFICS));
931 (*num_entries_by_type)[type]++; 931 (*num_entries_by_type)[type]++;
932 if (entry->ref(IS_DEL)) 932 if (entry->ref(IS_DEL))
933 (*num_to_delete_entries_by_type)[type]++; 933 (*num_to_delete_entries_by_type)[type]++;
934 } 934 }
935 } 935 }
936 936
937 scoped_ptr<base::ListValue> Directory::GetAllNodeDetails( 937 scoped_ptr<base::ListValue> Directory::GetNodeDetailsForType(
938 BaseTransaction* trans) { 938 BaseTransaction* trans,
939 ModelType type) {
939 scoped_ptr<base::ListValue> nodes(new base::ListValue()); 940 scoped_ptr<base::ListValue> nodes(new base::ListValue());
940 941
941 ScopedKernelLock lock(this); 942 ScopedKernelLock lock(this);
942 for (MetahandlesMap::iterator it = kernel_->metahandles_map.begin(); 943 for (MetahandlesMap::iterator it = kernel_->metahandles_map.begin();
943 it != kernel_->metahandles_map.end(); ++it) { 944 it != kernel_->metahandles_map.end(); ++it) {
945 if (GetModelTypeFromSpecifics(it->second->ref(SPECIFICS)) != type) {
946 continue;
947 }
948
944 EntryKernel* kernel = it->second; 949 EntryKernel* kernel = it->second;
945 scoped_ptr<base::DictionaryValue> node( 950 scoped_ptr<base::DictionaryValue> node(
946 kernel->ToValue(GetCryptographer(trans))); 951 kernel->ToValue(GetCryptographer(trans)));
947 952
948 // Add the position index if appropriate. This must be done here (and not 953 // Add the position index if appropriate. This must be done here (and not
949 // in EntryKernel) because the EntryKernel does not have access to its 954 // in EntryKernel) because the EntryKernel does not have access to its
950 // siblings. 955 // siblings.
951 if (kernel->ShouldMaintainPosition() && !kernel->ref(IS_DEL)) { 956 if (kernel->ShouldMaintainPosition() && !kernel->ref(IS_DEL)) {
952 node->SetInteger("positionIndex", GetPositionIndex(trans, kernel)); 957 node->SetInteger("positionIndex", GetPositionIndex(trans, kernel));
953 } 958 }
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 1303
1299 for (OrderedChildSet::const_iterator i = children->begin(); 1304 for (OrderedChildSet::const_iterator i = children->begin();
1300 i != children->end(); ++i) { 1305 i != children->end(); ++i) {
1301 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); 1306 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID));
1302 result->push_back((*i)->ref(META_HANDLE)); 1307 result->push_back((*i)->ref(META_HANDLE));
1303 } 1308 }
1304 } 1309 }
1305 1310
1306 } // namespace syncable 1311 } // namespace syncable
1307 } // namespace syncer 1312 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/directory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698