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

Unified Diff: net/base/registry_controlled_domain.cc

Issue 8226007: WORK_IN_PROGRESS: Do effective TLD lookups using a suffix trie (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « DEPS ('k') | net/net.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/registry_controlled_domain.cc
diff --git a/net/base/registry_controlled_domain.cc b/net/base/registry_controlled_domain.cc
index 2d1d4f2939c77471b2c1f509dee2032169add5d1..90e0273f42ec7d6b2fd0070b2e723b80e3dfe5a7 100644
--- a/net/base/registry_controlled_domain.cc
+++ b/net/base/registry_controlled_domain.cc
@@ -48,7 +48,11 @@
#include "net/base/net_module.h"
#include "net/base/net_util.h"
+#if defined(USE_DOMAIN_SUFFIX_TRIE)
+#include "third_party/domain-registry-provider/src/domain_registry/domain_registry.h"
+#else
#include "effective_tld_names.cc"
+#endif
namespace net {
@@ -142,9 +146,16 @@ RegistryControlledDomainService* RegistryControlledDomainService::GetInstance()
return Singleton<RegistryControlledDomainService>::get();
}
+#if defined(USE_DOMAIN_SUFFIX_TRIE)
RegistryControlledDomainService::RegistryControlledDomainService()
- : find_domain_function_(Perfect_Hash::FindDomain) {
+ : find_domain_function_(NULL) {
+ InitializeDomainRegistry();
}
+#else
+RegistryControlledDomainService::RegistryControlledDomainService()
+ : find_domain_function_() {
+}
+#endif
// static
RegistryControlledDomainService* RegistryControlledDomainService::SetInstance(
@@ -189,6 +200,17 @@ std::string RegistryControlledDomainService::GetDomainAndRegistryImpl(
return host.substr(dot + 1);
}
+#if defined(USE_DOMAIN_SUFFIX_TRIE)
+size_t RegistryControlledDomainService::GetRegistryLengthImpl(
+ const std::string& host,
+ bool allow_unknown_registries) {
+ DCHECK(!host.empty());
+ if (allow_unknown_registries)
+ return GetRegistryLengthAllowUnknownRegistries(host.c_str());
+ else
+ return ::GetRegistryLength(host.c_str());
+}
+#else
size_t RegistryControlledDomainService::GetRegistryLengthImpl(
const std::string& host,
bool allow_unknown_registries) {
@@ -267,5 +289,6 @@ size_t RegistryControlledDomainService::GetRegistryLengthImpl(
// registries, return the length of this subcomponent.
return allow_unknown_registries ? (host.length() - curr_start) : 0;
}
+#endif
} // namespace net
« no previous file with comments | « DEPS ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698