Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/allocator/allocator_extension.h" | 12 #include "base/allocator/allocator_extension.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/memory/discardable_memory_allocator.h" | 17 #include "base/memory/discardable_memory_allocator.h" |
| 18 #include "base/memory/shared_memory.h" | 18 #include "base/memory/shared_memory.h" |
| 19 #include "base/metrics/field_trial.h" | 19 #include "base/metrics/field_trial.h" |
| 20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
| 21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 22 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
| 23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 24 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
| 25 #include "base/strings/string_split.h" | |
| 25 #include "base/strings/string_tokenizer.h" | 26 #include "base/strings/string_tokenizer.h" |
| 26 #include "base/strings/sys_string_conversions.h" | 27 #include "base/strings/sys_string_conversions.h" |
| 27 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
| 28 #include "base/thread_task_runner_handle.h" | 29 #include "base/thread_task_runner_handle.h" |
| 29 #include "base/threading/simple_thread.h" | 30 #include "base/threading/simple_thread.h" |
| 30 #include "base/threading/thread_local.h" | 31 #include "base/threading/thread_local.h" |
| 31 #include "base/threading/thread_restrictions.h" | 32 #include "base/threading/thread_restrictions.h" |
| 32 #include "base/trace_event/memory_dump_manager.h" | 33 #include "base/trace_event/memory_dump_manager.h" |
| 33 #include "base/trace_event/trace_event.h" | 34 #include "base/trace_event/trace_event.h" |
| 34 #include "base/values.h" | 35 #include "base/values.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 125 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 125 #include "ipc/ipc_channel_handle.h" | 126 #include "ipc/ipc_channel_handle.h" |
| 126 #include "ipc/ipc_platform_file.h" | 127 #include "ipc/ipc_platform_file.h" |
| 127 #include "ipc/mojo/ipc_channel_mojo.h" | 128 #include "ipc/mojo/ipc_channel_mojo.h" |
| 128 #include "media/base/audio_hardware_config.h" | 129 #include "media/base/audio_hardware_config.h" |
| 129 #include "media/base/media.h" | 130 #include "media/base/media.h" |
| 130 #include "media/renderers/gpu_video_accelerator_factories.h" | 131 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 131 #include "mojo/common/common_type_converters.h" | 132 #include "mojo/common/common_type_converters.h" |
| 132 #include "net/base/net_errors.h" | 133 #include "net/base/net_errors.h" |
| 133 #include "net/base/port_util.h" | 134 #include "net/base/port_util.h" |
| 135 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | |
| 134 #include "skia/ext/event_tracer_impl.h" | 136 #include "skia/ext/event_tracer_impl.h" |
| 135 #include "skia/ext/skia_memory_dump_provider.h" | 137 #include "skia/ext/skia_memory_dump_provider.h" |
| 136 #include "third_party/WebKit/public/platform/WebImageGenerator.h" | 138 #include "third_party/WebKit/public/platform/WebImageGenerator.h" |
| 137 #include "third_party/WebKit/public/platform/WebString.h" | 139 #include "third_party/WebKit/public/platform/WebString.h" |
| 138 #include "third_party/WebKit/public/platform/WebThread.h" | 140 #include "third_party/WebKit/public/platform/WebThread.h" |
| 139 #include "third_party/WebKit/public/web/WebCache.h" | 141 #include "third_party/WebKit/public/web/WebCache.h" |
| 140 #include "third_party/WebKit/public/web/WebColorName.h" | 142 #include "third_party/WebKit/public/web/WebColorName.h" |
| 141 #include "third_party/WebKit/public/web/WebDatabase.h" | 143 #include "third_party/WebKit/public/web/WebDatabase.h" |
| 142 #include "third_party/WebKit/public/web/WebDocument.h" | 144 #include "third_party/WebKit/public/web/WebDocument.h" |
| 143 #include "third_party/WebKit/public/web/WebFrame.h" | 145 #include "third_party/WebKit/public/web/WebFrame.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 } | 272 } |
| 271 | 273 |
| 272 private: | 274 private: |
| 273 const std::string scheme_; | 275 const std::string scheme_; |
| 274 const std::string host_; | 276 const std::string host_; |
| 275 const double zoom_level_; | 277 const double zoom_level_; |
| 276 | 278 |
| 277 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer); | 279 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer); |
| 278 }; | 280 }; |
| 279 | 281 |
| 282 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
| |
| 283 // The Top10 sites have different TLD and/or subdomains | |
| 284 // depending on the localization | |
| 285 if (host == "sina.com.cn") | |
| 286 return true; | |
| 287 | |
| 288 std::string sanitized_host = | |
| 289 net::registry_controlled_domains::GetDomainAndRegistry( | |
|
jochen (gone - plz use gerrit)
2015/10/26 15:29:33
please use "git cl format" on this cl
| |
| 290 host, | |
| 291 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | |
| 292 | |
| 293 if (sanitized_host == "facebook.com") | |
| 294 return true; | |
| 295 if (sanitized_host == "baidu.com") | |
| 296 return true; | |
| 297 if (sanitized_host == "qq.com") | |
| 298 return true; | |
| 299 if (sanitized_host == "twitter.com") | |
| 300 return true; | |
| 301 if (sanitized_host == "taobao.com") | |
| 302 return true; | |
| 303 if (sanitized_host == "live.com") | |
| 304 return true; | |
| 305 | |
| 306 if (!sanitized_host.empty()) { | |
| 307 std::vector<base::StringPiece> host_tokens = base::SplitStringPiece( | |
| 308 sanitized_host, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | |
| 309 | |
| 310 if (host_tokens.size() >= 2) { | |
| 311 if ((host_tokens[0] == "yahoo") || | |
| 312 (host_tokens[0] == "amazon") || | |
| 313 (host_tokens[0] == "wikipedia")) { | |
| 314 return true; | |
| 315 } | |
| 316 } | |
| 317 } | |
| 318 return false; | |
| 319 } | |
| 320 | |
| 280 std::string HostToCustomHistogramSuffix(const std::string& host) { | 321 std::string HostToCustomHistogramSuffix(const std::string& host) { |
| 281 if (host == "mail.google.com") | 322 if (host == "mail.google.com") |
| 282 return ".gmail"; | 323 return ".gmail"; |
| 283 if (host == "docs.google.com" || host == "drive.google.com") | 324 if (host == "docs.google.com" || host == "drive.google.com") |
| 284 return ".docs"; | 325 return ".docs"; |
| 285 if (host == "plus.google.com") | 326 if (host == "plus.google.com") |
| 286 return ".plus"; | 327 return ".plus"; |
| 287 if (host == "inbox.google.com") | 328 if (host == "inbox.google.com") |
| 288 return ".inbox"; | 329 return ".inbox"; |
| 289 if (host == "www.youtube.com") | 330 if (host == "www.youtube.com") |
| 290 return ".youtube"; | 331 return ".youtube"; |
| 332 if (IsAlexaTop10NonGoogleSite(host)) | |
| 333 return ".top10"; | |
| 334 | |
| 291 return std::string(); | 335 return std::string(); |
| 292 } | 336 } |
| 293 | 337 |
| 294 void* CreateHistogram( | 338 void* CreateHistogram( |
| 295 const char *name, int min, int max, size_t buckets) { | 339 const char *name, int min, int max, size_t buckets) { |
| 296 if (min <= 0) | 340 if (min <= 0) |
| 297 min = 1; | 341 min = 1; |
| 298 std::string histogram_name; | 342 std::string histogram_name; |
| 299 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); | 343 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); |
| 300 if (render_thread_impl) { // Can be null in tests. | 344 if (render_thread_impl) { // Can be null in tests. |
| (...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1965 } | 2009 } |
| 1966 | 2010 |
| 1967 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2011 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
| 1968 size_t erased = | 2012 size_t erased = |
| 1969 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2013 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
| 1970 routing_id_); | 2014 routing_id_); |
| 1971 DCHECK_EQ(1u, erased); | 2015 DCHECK_EQ(1u, erased); |
| 1972 } | 2016 } |
| 1973 | 2017 |
| 1974 } // namespace content | 2018 } // namespace content |
| OLD | NEW |