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

Side by Side Diff: content/renderer/renderer_main.cc

Issue 1656983002: Remove dependency from content_renderer on startup_metric_utils_common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don`t change line endings 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 | « content/renderer/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/debugger.h" 10 #include "base/debug/debugger.h"
11 #include "base/debug/leak_annotations.h" 11 #include "base/debug/leak_annotations.h"
12 #include "base/feature_list.h" 12 #include "base/feature_list.h"
13 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/metrics/statistics_recorder.h" 17 #include "base/metrics/statistics_recorder.h"
18 #include "base/pending_task.h" 18 #include "base/pending_task.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/sys_info.h" 20 #include "base/sys_info.h"
21 #include "base/threading/platform_thread.h" 21 #include "base/threading/platform_thread.h"
22 #include "base/time/time.h"
23 #include "base/timer/hi_res_timer_manager.h" 22 #include "base/timer/hi_res_timer_manager.h"
24 #include "base/trace_event/trace_event.h" 23 #include "base/trace_event/trace_event.h"
25 #include "build/build_config.h" 24 #include "build/build_config.h"
26 #include "components/scheduler/renderer/renderer_scheduler.h" 25 #include "components/scheduler/renderer/renderer_scheduler.h"
27 #include "components/startup_metric_utils/common/startup_metric_messages.h"
28 #include "content/child/child_process.h" 26 #include "content/child/child_process.h"
29 #include "content/common/content_constants_internal.h" 27 #include "content/common/content_constants_internal.h"
30 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
31 #include "content/public/common/main_function_params.h" 29 #include "content/public/common/main_function_params.h"
32 #include "content/public/renderer/content_renderer_client.h" 30 #include "content/public/renderer/content_renderer_client.h"
33 #include "content/renderer/render_process_impl.h" 31 #include "content/renderer/render_process_impl.h"
34 #include "content/renderer/render_thread_impl.h" 32 #include "content/renderer/render_thread_impl.h"
35 #include "content/renderer/renderer_main_platform_delegate.h" 33 #include "content/renderer/renderer_main_platform_delegate.h"
36 #include "third_party/skia/include/core/SkGraphics.h" 34 #include "third_party/skia/include/core/SkGraphics.h"
37 #include "ui/base/ui_base_switches.h" 35 #include "ui/base/ui_base_switches.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #endif 83 #endif
86 84
87 } // namespace 85 } // namespace
88 86
89 // mainline routine for running as the Renderer process 87 // mainline routine for running as the Renderer process
90 int RendererMain(const MainFunctionParams& parameters) { 88 int RendererMain(const MainFunctionParams& parameters) {
91 // Don't use the TRACE_EVENT0 macro because the tracing infrastructure doesn't 89 // Don't use the TRACE_EVENT0 macro because the tracing infrastructure doesn't
92 // expect synchronous events around the main loop of a thread. 90 // expect synchronous events around the main loop of a thread.
93 TRACE_EVENT_ASYNC_BEGIN0("startup", "RendererMain", 0); 91 TRACE_EVENT_ASYNC_BEGIN0("startup", "RendererMain", 0);
94 92
95 const base::TimeTicks renderer_main_entry_time = base::TimeTicks::Now();
96
97 base::trace_event::TraceLog::GetInstance()->SetProcessName("Renderer"); 93 base::trace_event::TraceLog::GetInstance()->SetProcessName("Renderer");
98 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( 94 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex(
99 kTraceEventRendererProcessSortIndex); 95 kTraceEventRendererProcessSortIndex);
100 96
101 const base::CommandLine& parsed_command_line = parameters.command_line; 97 const base::CommandLine& parsed_command_line = parameters.command_line;
102 98
103 #if defined(MOJO_SHELL_CLIENT) 99 #if defined(MOJO_SHELL_CLIENT)
104 if (parsed_command_line.HasSwitch(switches::kEnableMojoShellConnection)) 100 if (parsed_command_line.HasSwitch(switches::kEnableMojoShellConnection))
105 MojoShellConnectionImpl::Create(); 101 MojoShellConnectionImpl::Create();
106 #endif 102 #endif
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 std::move(renderer_scheduler)); 207 std::move(renderer_scheduler));
212 #endif 208 #endif
213 bool run_loop = true; 209 bool run_loop = true;
214 if (!no_sandbox) 210 if (!no_sandbox)
215 run_loop = platform.EnableSandbox(); 211 run_loop = platform.EnableSandbox();
216 #if defined(OS_POSIX) && !defined(OS_MACOSX) 212 #if defined(OS_POSIX) && !defined(OS_MACOSX)
217 RenderProcessImpl render_process; 213 RenderProcessImpl render_process;
218 RenderThreadImpl::Create(std::move(main_message_loop), 214 RenderThreadImpl::Create(std::move(main_message_loop),
219 std::move(renderer_scheduler)); 215 std::move(renderer_scheduler));
220 #endif 216 #endif
221 RenderThreadImpl::current()->Send(
222 new StartupMetricHostMsg_RecordRendererMainEntryTime(
223 renderer_main_entry_time));
224 217
225 base::HighResolutionTimerManager hi_res_timer_manager; 218 base::HighResolutionTimerManager hi_res_timer_manager;
226 219
227 if (run_loop) { 220 if (run_loop) {
228 #if defined(OS_MACOSX) 221 #if defined(OS_MACOSX)
229 if (pool) 222 if (pool)
230 pool->Recycle(); 223 pool->Recycle();
231 #endif 224 #endif
232 TRACE_EVENT_ASYNC_BEGIN0("toplevel", "RendererMain.START_MSG_LOOP", 0); 225 TRACE_EVENT_ASYNC_BEGIN0("toplevel", "RendererMain.START_MSG_LOOP", 0);
233 base::MessageLoop::current()->Run(); 226 base::MessageLoop::current()->Run();
234 TRACE_EVENT_ASYNC_END0("toplevel", "RendererMain.START_MSG_LOOP", 0); 227 TRACE_EVENT_ASYNC_END0("toplevel", "RendererMain.START_MSG_LOOP", 0);
235 } 228 }
236 #if defined(LEAK_SANITIZER) 229 #if defined(LEAK_SANITIZER)
237 // Run leak detection before RenderProcessImpl goes out of scope. This helps 230 // Run leak detection before RenderProcessImpl goes out of scope. This helps
238 // ignore shutdown-only leaks. 231 // ignore shutdown-only leaks.
239 __lsan_do_leak_check(); 232 __lsan_do_leak_check();
240 #endif 233 #endif
241 } 234 }
242 platform.PlatformUninitialize(); 235 platform.PlatformUninitialize();
243 TRACE_EVENT_ASYNC_END0("startup", "RendererMain", 0); 236 TRACE_EVENT_ASYNC_END0("startup", "RendererMain", 0);
244 return 0; 237 return 0;
245 } 238 }
246 239
247 } // namespace content 240 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698