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

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

Issue 6250070: Added command line switches and UI (controlled via a build option) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Some cleanup Created 9 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 | Annotate | Revision Log
« chrome/common/profiling.cc ('K') | « chrome/common/profiling.cc ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #if defined(OS_MACOSX) 5 #if defined(OS_MACOSX)
6 #include <signal.h> 6 #include <signal.h>
7 #include <unistd.h> 7 #include <unistd.h>
8 #endif // OS_MACOSX 8 #endif // OS_MACOSX
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/mac/scoped_nsautorelease_pool.h" 12 #include "base/mac/scoped_nsautorelease_pool.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/metrics/stats_counters.h" 16 #include "base/metrics/stats_counters.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/process_util.h" 18 #include "base/process_util.h"
19 #include "base/string_util.h" 19 #include "base/string_util.h"
20 #include "base/threading/platform_thread.h" 20 #include "base/threading/platform_thread.h"
21 #include "chrome/common/chrome_constants.h" 21 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/chrome_counters.h" 22 #include "chrome/common/chrome_counters.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/gfx_resource_provider.h" 24 #include "chrome/common/gfx_resource_provider.h"
25 #include "chrome/common/hi_res_timer_manager.h" 25 #include "chrome/common/hi_res_timer_manager.h"
26 #include "chrome/common/logging_chrome.h" 26 #include "chrome/common/logging_chrome.h"
27 #include "chrome/common/main_function_params.h" 27 #include "chrome/common/main_function_params.h"
28 #include "chrome/common/net/net_resource_provider.h" 28 #include "chrome/common/net/net_resource_provider.h"
29 #include "chrome/common/pepper_plugin_registry.h" 29 #include "chrome/common/pepper_plugin_registry.h"
30 #include "chrome/common/profiling.h"
30 #include "chrome/renderer/renderer_main_platform_delegate.h" 31 #include "chrome/renderer/renderer_main_platform_delegate.h"
31 #include "chrome/renderer/render_process_impl.h" 32 #include "chrome/renderer/render_process_impl.h"
32 #include "chrome/renderer/render_thread.h" 33 #include "chrome/renderer/render_thread.h"
33 #include "gfx/gfx_module.h" 34 #include "gfx/gfx_module.h"
34 #include "grit/generated_resources.h" 35 #include "grit/generated_resources.h"
35 #include "net/base/net_module.h" 36 #include "net/base/net_module.h"
36 #include "ui/base/system_monitor/system_monitor.h" 37 #include "ui/base/system_monitor/system_monitor.h"
37 38
38 #if defined(OS_MACOSX) 39 #if defined(OS_MACOSX)
39 #include "base/eintr_wrapper.h" 40 #include "base/eintr_wrapper.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 179 }
179 } 180 }
180 181
181 // mainline routine for running as the Renderer process 182 // mainline routine for running as the Renderer process
182 int RendererMain(const MainFunctionParams& parameters) { 183 int RendererMain(const MainFunctionParams& parameters) {
183 TRACE_EVENT_BEGIN("RendererMain", 0, ""); 184 TRACE_EVENT_BEGIN("RendererMain", 0, "");
184 185
185 const CommandLine& parsed_command_line = parameters.command_line_; 186 const CommandLine& parsed_command_line = parameters.command_line_;
186 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; 187 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_;
187 188
189 Profiling::StartAtStart();
188 #if defined(OS_MACOSX) 190 #if defined(OS_MACOSX)
189 // TODO(viettrungluu): Code taken from browser_main.cc. 191 // TODO(viettrungluu): Code taken from browser_main.cc.
190 int pipefd[2]; 192 int pipefd[2];
191 int ret = pipe(pipefd); 193 int ret = pipe(pipefd);
192 if (ret < 0) { 194 if (ret < 0) {
193 PLOG(DFATAL) << "Failed to create pipe"; 195 PLOG(DFATAL) << "Failed to create pipe";
194 } else { 196 } else {
195 int shutdown_pipe_read_fd = pipefd[0]; 197 int shutdown_pipe_read_fd = pipefd[0];
196 g_shutdown_pipe_write_fd = pipefd[1]; 198 g_shutdown_pipe_write_fd = pipefd[1];
197 const size_t kShutdownDetectorThreadStackSize = 4096; 199 const size_t kShutdownDetectorThreadStackSize = 4096;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // As long as we use Cocoa in the renderer (for the forseeable future as of 236 // As long as we use Cocoa in the renderer (for the forseeable future as of
235 // now; see http://crbug.com/13890 for info) we need to have a UI loop. 237 // now; see http://crbug.com/13890 for info) we need to have a UI loop.
236 MessageLoop main_message_loop(MessageLoop::TYPE_UI); 238 MessageLoop main_message_loop(MessageLoop::TYPE_UI);
237 #else 239 #else
238 // The main message loop of the renderer services doesn't have IO or UI tasks, 240 // The main message loop of the renderer services doesn't have IO or UI tasks,
239 // unless in-process-plugins is used. 241 // unless in-process-plugins is used.
240 MessageLoop main_message_loop(RenderProcessImpl::InProcessPlugins() ? 242 MessageLoop main_message_loop(RenderProcessImpl::InProcessPlugins() ?
241 MessageLoop::TYPE_UI : MessageLoop::TYPE_DEFAULT); 243 MessageLoop::TYPE_UI : MessageLoop::TYPE_DEFAULT);
242 #endif 244 #endif
243 245
246 Profiling::MainMessageLoopStarted();
244 base::PlatformThread::SetName("CrRendererMain"); 247 base::PlatformThread::SetName("CrRendererMain");
245 248
246 ui::SystemMonitor system_monitor; 249 ui::SystemMonitor system_monitor;
247 HighResolutionTimerManager hi_res_timer_manager; 250 HighResolutionTimerManager hi_res_timer_manager;
248 251
249 platform.PlatformInitialize(); 252 platform.PlatformInitialize();
250 253
251 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); 254 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox);
252 platform.InitSandboxTests(no_sandbox); 255 platform.InitSandboxTests(no_sandbox);
253 256
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 pool->Recycle(); 301 pool->Recycle();
299 TRACE_EVENT_BEGIN("RendererMain.START_MSG_LOOP", 0, 0); 302 TRACE_EVENT_BEGIN("RendererMain.START_MSG_LOOP", 0, 0);
300 MessageLoop::current()->Run(); 303 MessageLoop::current()->Run();
301 TRACE_EVENT_END("RendererMain.START_MSG_LOOP", 0, 0); 304 TRACE_EVENT_END("RendererMain.START_MSG_LOOP", 0, 0);
302 } 305 }
303 } 306 }
304 platform.PlatformUninitialize(); 307 platform.PlatformUninitialize();
305 TRACE_EVENT_END("RendererMain", 0, ""); 308 TRACE_EVENT_END("RendererMain", 0, "");
306 return 0; 309 return 0;
307 } 310 }
OLDNEW
« chrome/common/profiling.cc ('K') | « chrome/common/profiling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698