OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/app/chrome_main.h" | 5 #include "chrome/app/chrome_main.h" |
6 | 6 |
7 #include "app/app_paths.h" | 7 #include "app/app_paths.h" |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.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" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "chrome/renderer/chrome_content_renderer_client.h" | 37 #include "chrome/renderer/chrome_content_renderer_client.h" |
38 #include "chrome/utility/chrome_content_utility_client.h" | 38 #include "chrome/utility/chrome_content_utility_client.h" |
39 #include "content/browser/renderer_host/render_process_host.h" | 39 #include "content/browser/renderer_host/render_process_host.h" |
40 #include "content/common/content_client.h" | 40 #include "content/common/content_client.h" |
41 #include "content/common/content_counters.h" | 41 #include "content/common/content_counters.h" |
42 #include "content/common/content_paths.h" | 42 #include "content/common/content_paths.h" |
43 #include "content/common/main_function_params.h" | 43 #include "content/common/main_function_params.h" |
44 #include "content/common/sandbox_init_wrapper.h" | 44 #include "content/common/sandbox_init_wrapper.h" |
45 #include "content/common/set_process_title.h" | 45 #include "content/common/set_process_title.h" |
46 #include "ipc/ipc_switches.h" | 46 #include "ipc/ipc_switches.h" |
| 47 #include "media/base/media.h" |
47 #include "ui/base/resource/resource_bundle.h" | 48 #include "ui/base/resource/resource_bundle.h" |
48 #include "ui/base/ui_base_paths.h" | 49 #include "ui/base/ui_base_paths.h" |
49 #include "ui/base/ui_base_switches.h" | 50 #include "ui/base/ui_base_switches.h" |
50 | 51 |
51 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
52 #include <algorithm> | 53 #include <algorithm> |
53 #include <malloc.h> | 54 #include <malloc.h> |
54 #include "base/string_util.h" | 55 #include "base/string_util.h" |
55 #include "base/win/registry.h" | 56 #include "base/win/registry.h" |
56 #include "sandbox/src/sandbox.h" | 57 #include "sandbox/src/sandbox.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 static const MainFunction kMainFunctions[] = { | 424 static const MainFunction kMainFunctions[] = { |
424 { switches::kRendererProcess, RendererMain }, | 425 { switches::kRendererProcess, RendererMain }, |
425 { switches::kExtensionProcess, RendererMain }, | 426 { switches::kExtensionProcess, RendererMain }, |
426 { switches::kWorkerProcess, WorkerMain }, | 427 { switches::kWorkerProcess, WorkerMain }, |
427 { switches::kPpapiPluginProcess, PpapiPluginMain }, | 428 { switches::kPpapiPluginProcess, PpapiPluginMain }, |
428 #if !defined(DISABLE_NACL) | 429 #if !defined(DISABLE_NACL) |
429 { switches::kNaClLoaderProcess, NaClMain }, | 430 { switches::kNaClLoaderProcess, NaClMain }, |
430 #endif | 431 #endif |
431 }; | 432 }; |
432 | 433 |
| 434 // Each Renderer we spawn will re-attempt initialization of the media |
| 435 // libraries, at which point failure will be detected and handled, so |
| 436 // we do not need to cope with initialization failures here. |
| 437 FilePath media_path; |
| 438 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path)) |
| 439 media::InitializeMediaLibrary(media_path); |
| 440 |
433 // This function call can return multiple times, once per fork(). | 441 // This function call can return multiple times, once per fork(). |
434 if (!ZygoteMain(main_function_params)) | 442 if (!ZygoteMain(main_function_params)) |
435 return 1; | 443 return 1; |
436 | 444 |
437 // Zygote::HandleForkRequest may have reallocated the command | 445 // Zygote::HandleForkRequest may have reallocated the command |
438 // line so update it here with the new version. | 446 // line so update it here with the new version. |
439 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 447 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
440 | 448 |
441 // The StatsTable must be initialized in each process; we already | 449 // The StatsTable must be initialized in each process; we already |
442 // initialized for the browser process, now we need to initialize | 450 // initialized for the browser process, now we need to initialize |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 | 841 |
834 if (SubprocessNeedsResourceBundle(process_type)) | 842 if (SubprocessNeedsResourceBundle(process_type)) |
835 ResourceBundle::CleanupSharedInstance(); | 843 ResourceBundle::CleanupSharedInstance(); |
836 | 844 |
837 logging::CleanupChromeLogging(); | 845 logging::CleanupChromeLogging(); |
838 | 846 |
839 chrome_main::LowLevelShutdown(); | 847 chrome_main::LowLevelShutdown(); |
840 | 848 |
841 return exit_code; | 849 return exit_code; |
842 } | 850 } |
OLD | NEW |