| 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/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/common/profiling.h" | 27 #include "chrome/common/profiling.h" |
| 28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/plugin/chrome_content_plugin_client.h" | 29 #include "chrome/plugin/chrome_content_plugin_client.h" |
| 30 #include "chrome/renderer/chrome_content_renderer_client.h" | 30 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 31 #include "chrome/utility/chrome_content_utility_client.h" | 31 #include "chrome/utility/chrome_content_utility_client.h" |
| 32 #include "content/common/content_counters.h" | 32 #include "content/common/content_counters.h" |
| 33 #include "content/public/browser/render_process_host.h" | 33 #include "content/public/browser/render_process_host.h" |
| 34 #include "content/public/common/content_client.h" | 34 #include "content/public/common/content_client.h" |
| 35 #include "content/public/common/content_paths.h" | 35 #include "content/public/common/content_paths.h" |
| 36 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches.h" |
| 37 #include "media/base/media.h" | |
| 38 #include "ui/base/resource/resource_bundle.h" | 37 #include "ui/base/resource/resource_bundle.h" |
| 39 #include "ui/base/ui_base_switches.h" | 38 #include "ui/base/ui_base_switches.h" |
| 40 | 39 |
| 41 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
| 42 #include <algorithm> | 41 #include <algorithm> |
| 43 #include <atlbase.h> | 42 #include <atlbase.h> |
| 44 #include <malloc.h> | 43 #include <malloc.h> |
| 45 #include "base/string_util.h" | 44 #include "base/string_util.h" |
| 46 #include "base/win/registry.h" | 45 #include "base/win/registry.h" |
| 47 #include "chrome/browser/policy/policy_path_parser.h" | 46 #include "chrome/browser/policy/policy_path_parser.h" |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 | 709 |
| 711 bool ChromeMainDelegate::DelaySandboxInitialization( | 710 bool ChromeMainDelegate::DelaySandboxInitialization( |
| 712 const std::string& process_type) { | 711 const std::string& process_type) { |
| 713 // NaClLoader does this in NaClMainPlatformDelegate::EnableSandbox(). | 712 // NaClLoader does this in NaClMainPlatformDelegate::EnableSandbox(). |
| 714 // No sandbox needed for relauncher. | 713 // No sandbox needed for relauncher. |
| 715 return process_type == switches::kNaClLoaderProcess || | 714 return process_type == switches::kNaClLoaderProcess || |
| 716 process_type == switches::kRelauncherProcess; | 715 process_type == switches::kRelauncherProcess; |
| 717 } | 716 } |
| 718 #elif defined(OS_POSIX) | 717 #elif defined(OS_POSIX) |
| 719 content::ZygoteForkDelegate* ChromeMainDelegate::ZygoteStarting() { | 718 content::ZygoteForkDelegate* ChromeMainDelegate::ZygoteStarting() { |
| 720 // Each Renderer we spawn will re-attempt initialization of the media | |
| 721 // libraries, at which point failure will be detected and handled, so | |
| 722 // we do not need to cope with initialization failures here. | |
| 723 FilePath media_path; | |
| 724 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path)) | |
| 725 media::InitializeMediaLibrary(media_path); | |
| 726 #if defined(DISABLE_NACL) | 719 #if defined(DISABLE_NACL) |
| 727 return NULL; | 720 return NULL; |
| 728 #else | 721 #else |
| 729 return new NaClForkDelegate(); | 722 return new NaClForkDelegate(); |
| 730 #endif | 723 #endif |
| 731 } | 724 } |
| 732 | 725 |
| 733 void ChromeMainDelegate::ZygoteForked() { | 726 void ChromeMainDelegate::ZygoteForked() { |
| 734 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 727 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 735 std::string process_type = | 728 std::string process_type = |
| 736 command_line.GetSwitchValueASCII(switches::kProcessType); | 729 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 737 | 730 |
| 738 Profiling::ProcessStarted(); | 731 Profiling::ProcessStarted(); |
| 739 if (Profiling::BeingProfiled()) { | 732 if (Profiling::BeingProfiled()) { |
| 740 base::debug::RestartProfilingAfterFork(); | 733 base::debug::RestartProfilingAfterFork(); |
| 741 SetUpProfilingShutdownHandler(); | 734 SetUpProfilingShutdownHandler(); |
| 742 } | 735 } |
| 743 | 736 |
| 744 #if defined(USE_LINUX_BREAKPAD) | 737 #if defined(USE_LINUX_BREAKPAD) |
| 745 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets | 738 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets |
| 746 // this up for the browser process in a different manner. | 739 // this up for the browser process in a different manner. |
| 747 InitCrashReporter(); | 740 InitCrashReporter(); |
| 748 #endif | 741 #endif |
| 749 | 742 |
| 750 InitializeChromeContentClient(process_type); | 743 InitializeChromeContentClient(process_type); |
| 751 } | 744 } |
| 752 #endif // OS_MACOSX | 745 #endif // OS_MACOSX |
| OLD | NEW |