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

Side by Side Diff: components/ssl_errors/error_classification.h

Issue 1690593002: Reduce memory use of GetLevenshteinDistance() by almost 50% (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile? Created 4 years, 10 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
« no previous file with comments | « no previous file | components/ssl_errors/error_classification.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ 5 #ifndef COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_
6 #define COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ 6 #define COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // absence of the single-label prefix "www". E.g.: (The first domain 56 // absence of the single-label prefix "www". E.g.: (The first domain
57 // is hostname and the second domain is a DNS name in the certificate) 57 // is hostname and the second domain is a DNS name in the certificate)
58 // www.example.com ~ example.com -> true 58 // www.example.com ~ example.com -> true
59 // example.com ~ www.example.com -> true 59 // example.com ~ www.example.com -> true
60 // www.food.example.com ~ example.com -> false 60 // www.food.example.com ~ example.com -> false
61 // mail.example.com ~ example.com -> false 61 // mail.example.com ~ example.com -> false
62 bool GetWWWSubDomainMatch(const GURL& request_url, 62 bool GetWWWSubDomainMatch(const GURL& request_url,
63 const std::vector<std::string>& dns_names, 63 const std::vector<std::string>& dns_names,
64 std::string* www_match_host_name); 64 std::string* www_match_host_name);
65 65
66 // Exposed for testing.
67 size_t GetLevenshteinDistance(const std::string& str1, const std::string& str2);
felt 2016/02/11 00:10:42 Could you move this into the "helper methods" sect
68
66 // Method for recording results. ----------------------------------------------- 69 // Method for recording results. -----------------------------------------------
67 70
68 void RecordUMAStatistics(bool overridable, 71 void RecordUMAStatistics(bool overridable,
69 const base::Time& current_time, 72 const base::Time& current_time,
70 const GURL& request_url, 73 const GURL& request_url,
71 int cert_error, 74 int cert_error,
72 const net::X509Certificate& cert); 75 const net::X509Certificate& cert);
73 76
74 // Helper methods for classification. ------------------------------------------ 77 // Helper methods for classification. ------------------------------------------
75 78
(...skipping 20 matching lines...) Expand all
96 // Returns true if any of the |potential_children| is a subdomain of the 99 // Returns true if any of the |potential_children| is a subdomain of the
97 // |parent|. The inverse case should be treated carefully as this is most 100 // |parent|. The inverse case should be treated carefully as this is most
98 // likely a MITM attack. We don't want foo.appspot.com to be able to MITM for 101 // likely a MITM attack. We don't want foo.appspot.com to be able to MITM for
99 // appspot.com. 102 // appspot.com.
100 bool AnyNamesUnderName(const std::vector<HostnameTokens>& potential_children, 103 bool AnyNamesUnderName(const std::vector<HostnameTokens>& potential_children,
101 const HostnameTokens& parent); 104 const HostnameTokens& parent);
102 105
103 } // namespace ssl_errors 106 } // namespace ssl_errors
104 107
105 #endif // COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ 108 #endif // COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_
OLDNEW
« no previous file with comments | « no previous file | components/ssl_errors/error_classification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698