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

Side by Side Diff: chrome/browser/bookmarks/bookmark_index.cc

Issue 267019: Add the ability to unload the HistoryBackend.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/bookmarks/bookmark_index.h" 5 #include "chrome/browser/bookmarks/bookmark_index.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 i != node_typed_counts.end() && results->size() < max_count; ++i) 73 i != node_typed_counts.end() && results->size() < max_count; ++i)
74 AddMatchToResults(i->first, &parser, query_nodes.get(), results); 74 AddMatchToResults(i->first, &parser, query_nodes.get(), results);
75 } 75 }
76 76
77 void BookmarkIndex::SortMatches(const Matches& matches, 77 void BookmarkIndex::SortMatches(const Matches& matches,
78 NodeTypedCountPairs* node_typed_counts) const { 78 NodeTypedCountPairs* node_typed_counts) const {
79 HistoryService* const history_service = profile_ ? 79 HistoryService* const history_service = profile_ ?
80 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS) : NULL; 80 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS) : NULL;
81 81
82 history::URLDatabase* url_db = history_service ? 82 history::URLDatabase* url_db = history_service ?
83 history_service->in_memory_database() : NULL; 83 history_service->InMemoryDatabase() : NULL;
84 84
85 for (Matches::const_iterator i = matches.begin(); i != matches.end(); ++i) 85 for (Matches::const_iterator i = matches.begin(); i != matches.end(); ++i)
86 ExtractBookmarkNodePairs(url_db, *i, node_typed_counts); 86 ExtractBookmarkNodePairs(url_db, *i, node_typed_counts);
87 87
88 std::sort(node_typed_counts->begin(), node_typed_counts->end(), 88 std::sort(node_typed_counts->begin(), node_typed_counts->end(),
89 &NodeTypedCountPairSortFunc); 89 &NodeTypedCountPairSortFunc);
90 } 90 }
91 91
92 void BookmarkIndex::ExtractBookmarkNodePairs( 92 void BookmarkIndex::ExtractBookmarkNodePairs(
93 history::URLDatabase* url_db, 93 history::URLDatabase* url_db,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 Index::iterator i = index_.find(term); 230 Index::iterator i = index_.find(term);
231 if (i == index_.end()) { 231 if (i == index_.end()) {
232 // We can get here if the node has the same term more than once. For 232 // We can get here if the node has the same term more than once. For
233 // example, a bookmark with the title 'foo foo' would end up here. 233 // example, a bookmark with the title 'foo foo' would end up here.
234 return; 234 return;
235 } 235 }
236 i->second.erase(node); 236 i->second.erase(node);
237 if (i->second.empty()) 237 if (i->second.empty())
238 index_.erase(i); 238 index_.erase(i);
239 } 239 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_profile_impl.h ('k') | chrome/browser/bookmarks/bookmark_index_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698