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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 1399853004: Collect separate V8 histograms for Top10 non-Google sites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made requested changes Created 5 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 82feaa80f293e6038cd63a9ab82991e415c855b2..269ebc67e29df74ae98a319485f4d3329a1cd738 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -22,6 +22,7 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_split.h"
#include "base/strings/string_tokenizer.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -131,6 +132,7 @@
#include "mojo/common/common_type_converters.h"
#include "net/base/net_errors.h"
#include "net/base/port_util.h"
+#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "skia/ext/event_tracer_impl.h"
#include "skia/ext/skia_memory_dump_provider.h"
#include "third_party/WebKit/public/platform/WebImageGenerator.h"
@@ -277,6 +279,45 @@ class RenderViewZoomer : public RenderViewVisitor {
DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer);
};
+bool IsAlexaTop10NonGoogleSite(const std::string& host) {
jochen (gone - plz use gerrit) 2015/10/26 15:29:33 just make this a method of HistogramCustomizer, th
+ // The Top10 sites have different TLD and/or subdomains
+ // depending on the localization
+ if (host == "sina.com.cn")
+ return true;
+
+ std::string sanitized_host =
+ net::registry_controlled_domains::GetDomainAndRegistry(
jochen (gone - plz use gerrit) 2015/10/26 15:29:33 please use "git cl format" on this cl
+ host,
+ net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
+
+ if (sanitized_host == "facebook.com")
+ return true;
+ if (sanitized_host == "baidu.com")
+ return true;
+ if (sanitized_host == "qq.com")
+ return true;
+ if (sanitized_host == "twitter.com")
+ return true;
+ if (sanitized_host == "taobao.com")
+ return true;
+ if (sanitized_host == "live.com")
+ return true;
+
+ if (!sanitized_host.empty()) {
+ std::vector<base::StringPiece> host_tokens = base::SplitStringPiece(
+ sanitized_host, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+
+ if (host_tokens.size() >= 2) {
+ if ((host_tokens[0] == "yahoo") ||
+ (host_tokens[0] == "amazon") ||
+ (host_tokens[0] == "wikipedia")) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
std::string HostToCustomHistogramSuffix(const std::string& host) {
if (host == "mail.google.com")
return ".gmail";
@@ -288,6 +329,9 @@ std::string HostToCustomHistogramSuffix(const std::string& host) {
return ".inbox";
if (host == "www.youtube.com")
return ".youtube";
+ if (IsAlexaTop10NonGoogleSite(host))
+ return ".top10";
+
return std::string();
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698