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 "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/crash_logging.h" | 10 #include "base/debug/crash_logging.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/metrics/user_metrics_action.h" | 15 #include "base/metrics/user_metrics_action.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/time/time.h" | |
19 #include "base/values.h" | 20 #include "base/values.h" |
20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
21 #include "chrome/common/channel_info.h" | 22 #include "chrome/common/channel_info.h" |
22 #include "chrome/common/chrome_isolated_world_ids.h" | 23 #include "chrome/common/chrome_isolated_world_ids.h" |
23 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/crash_keys.h" | 26 #include "chrome/common/crash_keys.h" |
26 #include "chrome/common/pepper_permission_util.h" | 27 #include "chrome/common/pepper_permission_util.h" |
27 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
28 #include "chrome/common/secure_origin_whitelist.h" | 29 #include "chrome/common/secure_origin_whitelist.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 #include "components/dom_distiller/core/url_constants.h" | 68 #include "components/dom_distiller/core/url_constants.h" |
68 #include "components/error_page/common/localized_error.h" | 69 #include "components/error_page/common/localized_error.h" |
69 #include "components/nacl/renderer/ppb_nacl_private.h" | 70 #include "components/nacl/renderer/ppb_nacl_private.h" |
70 #include "components/nacl/renderer/ppb_nacl_private_impl.h" | 71 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
71 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" | 72 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" |
72 #include "components/page_load_metrics/renderer/metrics_render_frame_observer.h" | 73 #include "components/page_load_metrics/renderer/metrics_render_frame_observer.h" |
73 #include "components/password_manager/content/renderer/credential_manager_client .h" | 74 #include "components/password_manager/content/renderer/credential_manager_client .h" |
74 #include "components/pdf/renderer/pepper_pdf_host.h" | 75 #include "components/pdf/renderer/pepper_pdf_host.h" |
75 #include "components/plugins/renderer/mobile_youtube_plugin.h" | 76 #include "components/plugins/renderer/mobile_youtube_plugin.h" |
76 #include "components/signin/core/common/profile_management_switches.h" | 77 #include "components/signin/core/common/profile_management_switches.h" |
78 #include "components/startup_metric_utils/common/startup_metric_messages.h" | |
77 #include "components/version_info/version_info.h" | 79 #include "components/version_info/version_info.h" |
78 #include "components/visitedlink/renderer/visitedlink_slave.h" | 80 #include "components/visitedlink/renderer/visitedlink_slave.h" |
79 #include "components/web_cache/renderer/web_cache_render_process_observer.h" | 81 #include "components/web_cache/renderer/web_cache_render_process_observer.h" |
80 #include "content/public/common/content_constants.h" | 82 #include "content/public/common/content_constants.h" |
81 #include "content/public/common/content_switches.h" | 83 #include "content/public/common/content_switches.h" |
82 #include "content/public/renderer/plugin_instance_throttler.h" | 84 #include "content/public/renderer/plugin_instance_throttler.h" |
83 #include "content/public/renderer/render_frame.h" | 85 #include "content/public/renderer/render_frame.h" |
84 #include "content/public/renderer/render_thread.h" | 86 #include "content/public/renderer/render_thread.h" |
85 #include "content/public/renderer/render_view.h" | 87 #include "content/public/renderer/render_view.h" |
86 #include "content/public/renderer/render_view_visitor.h" | 88 #include "content/public/renderer/render_view_visitor.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]); | 314 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]); |
313 #endif | 315 #endif |
314 #if defined(ENABLE_PRINTING) | 316 #if defined(ENABLE_PRINTING) |
315 printing::SetAgent(GetUserAgent()); | 317 printing::SetAgent(GetUserAgent()); |
316 #endif | 318 #endif |
317 } | 319 } |
318 | 320 |
319 ChromeContentRendererClient::~ChromeContentRendererClient() { | 321 ChromeContentRendererClient::~ChromeContentRendererClient() { |
320 } | 322 } |
321 | 323 |
324 void ChromeContentRendererClient::RendererMainEntered() { | |
325 // Record the main entry time. It will be sent to the browser process via an | |
326 // IPC once the RenderThread has been created. | |
327 DCHECK(renderer_main_entry_time_.is_null()); | |
328 renderer_main_entry_time_ = base::TimeTicks::Now(); | |
jam
2016/02/01 23:28:02
why not just do this in the constructor to avoid a
fdoray
2016/02/02 01:32:49
Done.
| |
329 } | |
330 | |
322 void ChromeContentRendererClient::RenderThreadStarted() { | 331 void ChromeContentRendererClient::RenderThreadStarted() { |
323 RenderThread* thread = RenderThread::Get(); | 332 RenderThread* thread = RenderThread::Get(); |
324 | 333 |
334 DCHECK(!renderer_main_entry_time_.is_null()); | |
335 thread->Send(new StartupMetricHostMsg_RecordRendererMainEntryTime( | |
336 renderer_main_entry_time_)); | |
337 | |
325 chrome_observer_.reset(new ChromeRenderProcessObserver()); | 338 chrome_observer_.reset(new ChromeRenderProcessObserver()); |
326 web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver()); | 339 web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver()); |
327 | 340 |
328 #if defined(ENABLE_EXTENSIONS) | 341 #if defined(ENABLE_EXTENSIONS) |
329 ChromeExtensionsRendererClient::GetInstance()->RenderThreadStarted(); | 342 ChromeExtensionsRendererClient::GetInstance()->RenderThreadStarted(); |
330 #endif | 343 #endif |
331 | 344 |
332 prescient_networking_dispatcher_.reset( | 345 prescient_networking_dispatcher_.reset( |
333 new network_hints::PrescientNetworkingDispatcher()); | 346 new network_hints::PrescientNetworkingDispatcher()); |
334 #if defined(ENABLE_SPELLCHECK) | 347 #if defined(ENABLE_SPELLCHECK) |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1414 // chrome.system.network.getNetworkInterfaces provides the same | 1427 // chrome.system.network.getNetworkInterfaces provides the same |
1415 // information. Also, the enforcement of sending and binding UDP is already done | 1428 // information. Also, the enforcement of sending and binding UDP is already done |
1416 // by chrome extension permission model. | 1429 // by chrome extension permission model. |
1417 bool ChromeContentRendererClient::ShouldEnforceWebRTCRoutingPreferences() { | 1430 bool ChromeContentRendererClient::ShouldEnforceWebRTCRoutingPreferences() { |
1418 #if defined(ENABLE_EXTENSIONS) | 1431 #if defined(ENABLE_EXTENSIONS) |
1419 return !IsStandaloneExtensionProcess(); | 1432 return !IsStandaloneExtensionProcess(); |
1420 #else | 1433 #else |
1421 return true; | 1434 return true; |
1422 #endif | 1435 #endif |
1423 } | 1436 } |
OLD | NEW |