OLD | NEW |
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 "components/url_matcher/substring_set_matcher.h" | 5 #include "components/url_matcher/substring_set_matcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 const uint32 follow_in_case_of_failure = | 222 const uint32 follow_in_case_of_failure = |
223 edge_from_failure != AhoCorasickNode::kNoSuchEdge | 223 edge_from_failure != AhoCorasickNode::kNoSuchEdge |
224 ? edge_from_failure | 224 ? edge_from_failure |
225 : 0; | 225 : 0; |
226 tree_[leads_to].set_failure(follow_in_case_of_failure); | 226 tree_[leads_to].set_failure(follow_in_case_of_failure); |
227 tree_[leads_to].AddMatches(tree_[follow_in_case_of_failure].matches()); | 227 tree_[leads_to].AddMatches(tree_[follow_in_case_of_failure].matches()); |
228 } | 228 } |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
232 const uint32 SubstringSetMatcher::AhoCorasickNode::kNoSuchEdge = ~0; | 232 const uint32 SubstringSetMatcher::AhoCorasickNode::kNoSuchEdge = 0xFFFFFFFF; |
233 | 233 |
234 SubstringSetMatcher::AhoCorasickNode::AhoCorasickNode() | 234 SubstringSetMatcher::AhoCorasickNode::AhoCorasickNode() |
235 : failure_(kNoSuchEdge) {} | 235 : failure_(kNoSuchEdge) {} |
236 | 236 |
237 SubstringSetMatcher::AhoCorasickNode::~AhoCorasickNode() {} | 237 SubstringSetMatcher::AhoCorasickNode::~AhoCorasickNode() {} |
238 | 238 |
239 SubstringSetMatcher::AhoCorasickNode::AhoCorasickNode( | 239 SubstringSetMatcher::AhoCorasickNode::AhoCorasickNode( |
240 const SubstringSetMatcher::AhoCorasickNode& other) | 240 const SubstringSetMatcher::AhoCorasickNode& other) |
241 : edges_(other.edges_), | 241 : edges_(other.edges_), |
242 failure_(other.failure_), | 242 failure_(other.failure_), |
(...skipping 20 matching lines...) Expand all Loading... |
263 void SubstringSetMatcher::AhoCorasickNode::AddMatch(StringPattern::ID id) { | 263 void SubstringSetMatcher::AhoCorasickNode::AddMatch(StringPattern::ID id) { |
264 matches_.insert(id); | 264 matches_.insert(id); |
265 } | 265 } |
266 | 266 |
267 void SubstringSetMatcher::AhoCorasickNode::AddMatches( | 267 void SubstringSetMatcher::AhoCorasickNode::AddMatches( |
268 const SubstringSetMatcher::AhoCorasickNode::Matches& matches) { | 268 const SubstringSetMatcher::AhoCorasickNode::Matches& matches) { |
269 matches_.insert(matches.begin(), matches.end()); | 269 matches_.insert(matches.begin(), matches.end()); |
270 } | 270 } |
271 | 271 |
272 } // namespace url_matcher | 272 } // namespace url_matcher |
OLD | NEW |