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

Side by Side Diff: content/app/content_main_runner.cc

Issue 23235002: Set up content in-process main threads via factory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't add targets (were already in !ios block) Created 7 years, 4 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
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 "content/public/app/content_main_runner.h" 5 #include "content/public/app/content_main_runner.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/allocator/allocator_extension.h" 9 #include "base/allocator/allocator_extension.h"
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/debugger.h" 12 #include "base/debug/debugger.h"
13 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/i18n/icu_util.h" 15 #include "base/i18n/icu_util.h"
16 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/metrics/stats_table.h" 19 #include "base/metrics/stats_table.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/process/launch.h" 21 #include "base/process/launch.h"
22 #include "base/process/memory.h" 22 #include "base/process/memory.h"
23 #include "base/process/process_handle.h" 23 #include "base/process/process_handle.h"
24 #include "base/profiler/alternate_timer.h" 24 #include "base/profiler/alternate_timer.h"
25 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
26 #include "base/strings/string_util.h" 26 #include "base/strings/string_util.h"
27 #include "base/strings/stringprintf.h" 27 #include "base/strings/stringprintf.h"
28 #include "content/browser/browser_main.h" 28 #include "content/browser/browser_main.h"
29 #include "content/browser/gpu/gpu_process_host.h"
29 #include "content/common/set_process_title.h" 30 #include "content/common/set_process_title.h"
30 #include "content/common/url_schemes.h" 31 #include "content/common/url_schemes.h"
32 #include "content/gpu/gpu_main_thread.h"
31 #include "content/public/app/content_main_delegate.h" 33 #include "content/public/app/content_main_delegate.h"
32 #include "content/public/app/startup_helper_win.h" 34 #include "content/public/app/startup_helper_win.h"
33 #include "content/public/browser/content_browser_client.h" 35 #include "content/public/browser/content_browser_client.h"
36 #include "content/public/browser/render_process_host.h"
37 #include "content/public/browser/utility_process_host.h"
34 #include "content/public/common/content_client.h" 38 #include "content/public/common/content_client.h"
35 #include "content/public/common/content_constants.h" 39 #include "content/public/common/content_constants.h"
36 #include "content/public/common/content_paths.h" 40 #include "content/public/common/content_paths.h"
37 #include "content/public/common/content_switches.h" 41 #include "content/public/common/content_switches.h"
38 #include "content/public/common/main_function_params.h" 42 #include "content/public/common/main_function_params.h"
39 #include "content/public/common/sandbox_init.h" 43 #include "content/public/common/sandbox_init.h"
44 #include "content/renderer/renderer_main_thread.h"
45 #include "content/utility/utility_main_thread.h"
40 #include "crypto/nss_util.h" 46 #include "crypto/nss_util.h"
41 #include "ipc/ipc_switches.h" 47 #include "ipc/ipc_switches.h"
42 #include "media/base/media.h" 48 #include "media/base/media.h"
43 #include "sandbox/win/src/sandbox_types.h" 49 #include "sandbox/win/src/sandbox_types.h"
44 #include "ui/base/ui_base_paths.h" 50 #include "ui/base/ui_base_paths.h"
45 #include "ui/base/ui_base_switches.h" 51 #include "ui/base/ui_base_switches.h"
46 #include "ui/base/win/dpi.h" 52 #include "ui/base/win/dpi.h"
47 #include "webkit/common/user_agent/user_agent.h" 53 #include "webkit/common/user_agent/user_agent.h"
48 54
49 #if defined(USE_TCMALLOC) 55 #if defined(USE_TCMALLOC)
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 { switches::kWorkerProcess, WorkerMain }, 423 { switches::kWorkerProcess, WorkerMain },
418 { switches::kPpapiPluginProcess, PpapiPluginMain }, 424 { switches::kPpapiPluginProcess, PpapiPluginMain },
419 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, 425 { switches::kPpapiBrokerProcess, PpapiBrokerMain },
420 #endif // ENABLE_PLUGINS 426 #endif // ENABLE_PLUGINS
421 { switches::kUtilityProcess, UtilityMain }, 427 { switches::kUtilityProcess, UtilityMain },
422 { switches::kRendererProcess, RendererMain }, 428 { switches::kRendererProcess, RendererMain },
423 { switches::kGpuProcess, GpuMain }, 429 { switches::kGpuProcess, GpuMain },
424 #endif // !CHROME_MULTIPLE_DLL_BROWSER 430 #endif // !CHROME_MULTIPLE_DLL_BROWSER
425 }; 431 };
426 432
433 #if !defined(CHROME_MULTIPLE_DLL_BROWSER)
434 UtilityProcessHost::RegisterUtilityMainThreadFactory(CreateUtilityMainThread);
435 RenderProcessHost::RegisterRendererMainThreadFactory(
436 CreateRendererMainThread);
437 GpuProcessHost::RegisterGpuMainThreadFactory(CreateGpuMainThread);
438 #endif
439
427 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { 440 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) {
428 if (process_type == kMainFunctions[i].name) { 441 if (process_type == kMainFunctions[i].name) {
429 if (delegate) { 442 if (delegate) {
430 int exit_code = delegate->RunProcess(process_type, 443 int exit_code = delegate->RunProcess(process_type,
431 main_function_params); 444 main_function_params);
432 #if defined(OS_ANDROID) 445 #if defined(OS_ANDROID)
433 // In Android's browser process, the negative exit code doesn't mean the 446 // In Android's browser process, the negative exit code doesn't mean the
434 // default behavior should be used as the UI message loop is managed by 447 // default behavior should be used as the UI message loop is managed by
435 // the Java and the browser process's default behavior is always 448 // the Java and the browser process's default behavior is always
436 // overridden. 449 // overridden.
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 834
822 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 835 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
823 }; 836 };
824 837
825 // static 838 // static
826 ContentMainRunner* ContentMainRunner::Create() { 839 ContentMainRunner* ContentMainRunner::Create() {
827 return new ContentMainRunnerImpl(); 840 return new ContentMainRunnerImpl();
828 } 841 }
829 842
830 } // namespace content 843 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698