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

Side by Side Diff: chrome/browser/extensions/api/declarative/substring_set_matcher.cc

Issue 9830001: Initialize SubstringSetMatcher on construction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | « no previous file | chrome/browser/extensions/api/declarative/substring_set_matcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/api/declarative/substring_set_matcher.h" 5 #include "chrome/browser/extensions/api/declarative/substring_set_matcher.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 13 matching lines...) Expand all
24 bool SubstringPattern::operator<(const SubstringPattern& rhs) const { 24 bool SubstringPattern::operator<(const SubstringPattern& rhs) const {
25 if (id_ < rhs.id_) return true; 25 if (id_ < rhs.id_) return true;
26 if (id_ > rhs.id_) return false; 26 if (id_ > rhs.id_) return false;
27 return pattern_ < rhs.pattern_; 27 return pattern_ < rhs.pattern_;
28 } 28 }
29 29
30 // 30 //
31 // SubstringSetMatcher 31 // SubstringSetMatcher
32 // 32 //
33 33
34 SubstringSetMatcher::SubstringSetMatcher() {} 34 SubstringSetMatcher::SubstringSetMatcher() {
35 RebuildAhoCorasickTree();
36 }
35 37
36 SubstringSetMatcher::~SubstringSetMatcher() {} 38 SubstringSetMatcher::~SubstringSetMatcher() {}
37 39
38 void SubstringSetMatcher::RegisterPatterns( 40 void SubstringSetMatcher::RegisterPatterns(
39 const std::vector<const SubstringPattern*>& patterns) { 41 const std::vector<const SubstringPattern*>& patterns) {
40 RegisterAndUnregisterPatterns(patterns, 42 RegisterAndUnregisterPatterns(patterns,
41 std::vector<const SubstringPattern*>()); 43 std::vector<const SubstringPattern*>());
42 } 44 }
43 45
44 void SubstringSetMatcher::UnregisterPatterns( 46 void SubstringSetMatcher::UnregisterPatterns(
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 void SubstringSetMatcher::AhoCorasickNode::AddMatch(SubstringPattern::ID id) { 210 void SubstringSetMatcher::AhoCorasickNode::AddMatch(SubstringPattern::ID id) {
209 matches_.insert(id); 211 matches_.insert(id);
210 } 212 }
211 213
212 void SubstringSetMatcher::AhoCorasickNode::AddMatches( 214 void SubstringSetMatcher::AhoCorasickNode::AddMatches(
213 const SubstringSetMatcher::AhoCorasickNode::Matches& matches) { 215 const SubstringSetMatcher::AhoCorasickNode::Matches& matches) {
214 matches_.insert(matches.begin(), matches.end()); 216 matches_.insert(matches.begin(), matches.end());
215 } 217 }
216 218
217 } // namespace extensions 219 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/declarative/substring_set_matcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698