| 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 "content/public/app/content_main_runner.h" | 5 #include "content/public/app/content_main_runner.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "content/public/common/content_switches.h" | 60 #include "content/public/common/content_switches.h" |
| 61 #include "content/public/common/main_function_params.h" | 61 #include "content/public/common/main_function_params.h" |
| 62 #include "content/public/common/sandbox_init.h" | 62 #include "content/public/common/sandbox_init.h" |
| 63 #include "content/public/gpu/content_gpu_client.h" | 63 #include "content/public/gpu/content_gpu_client.h" |
| 64 #include "content/public/renderer/content_renderer_client.h" | 64 #include "content/public/renderer/content_renderer_client.h" |
| 65 #include "content/public/utility/content_utility_client.h" | 65 #include "content/public/utility/content_utility_client.h" |
| 66 #include "content/renderer/in_process_renderer_thread.h" | 66 #include "content/renderer/in_process_renderer_thread.h" |
| 67 #include "content/utility/in_process_utility_thread.h" | 67 #include "content/utility/in_process_utility_thread.h" |
| 68 #include "ipc/ipc_descriptors.h" | 68 #include "ipc/ipc_descriptors.h" |
| 69 #include "media/base/media.h" | 69 #include "media/base/media.h" |
| 70 #include "ppapi/features/features.h" |
| 70 #include "ui/base/ui_base_paths.h" | 71 #include "ui/base/ui_base_paths.h" |
| 71 #include "ui/base/ui_base_switches.h" | 72 #include "ui/base/ui_base_switches.h" |
| 72 | 73 |
| 73 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 74 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 74 #include "gin/v8_initializer.h" | 75 #include "gin/v8_initializer.h" |
| 75 #endif | 76 #endif |
| 76 | 77 |
| 77 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
| 78 #include <malloc.h> | 79 #include <malloc.h> |
| 79 #include <cstring> | 80 #include <cstring> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 105 #endif | 106 #endif |
| 106 | 107 |
| 107 #endif // OS_POSIX | 108 #endif // OS_POSIX |
| 108 | 109 |
| 109 #if defined(USE_NSS_CERTS) | 110 #if defined(USE_NSS_CERTS) |
| 110 #include "crypto/nss_util.h" | 111 #include "crypto/nss_util.h" |
| 111 #endif | 112 #endif |
| 112 | 113 |
| 113 namespace content { | 114 namespace content { |
| 114 extern int GpuMain(const content::MainFunctionParams&); | 115 extern int GpuMain(const content::MainFunctionParams&); |
| 115 #if defined(ENABLE_PLUGINS) | 116 #if BUILDFLAG(ENABLE_PLUGINS) |
| 116 #if !defined(OS_LINUX) | 117 #if !defined(OS_LINUX) |
| 117 extern int PluginMain(const content::MainFunctionParams&); | 118 extern int PluginMain(const content::MainFunctionParams&); |
| 118 #endif | 119 #endif |
| 119 extern int PpapiPluginMain(const MainFunctionParams&); | 120 extern int PpapiPluginMain(const MainFunctionParams&); |
| 120 extern int PpapiBrokerMain(const MainFunctionParams&); | 121 extern int PpapiBrokerMain(const MainFunctionParams&); |
| 121 #endif | 122 #endif |
| 122 extern int RendererMain(const content::MainFunctionParams&); | 123 extern int RendererMain(const content::MainFunctionParams&); |
| 123 extern int UtilityMain(const MainFunctionParams&); | 124 extern int UtilityMain(const MainFunctionParams&); |
| 124 } // namespace content | 125 } // namespace content |
| 125 | 126 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 293 |
| 293 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 294 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 294 // On platforms that use the zygote, we have a special subset of | 295 // On platforms that use the zygote, we have a special subset of |
| 295 // subprocesses that are launched via the zygote. This function | 296 // subprocesses that are launched via the zygote. This function |
| 296 // fills in some process-launching bits around ZygoteMain(). | 297 // fills in some process-launching bits around ZygoteMain(). |
| 297 // Returns the exit code of the subprocess. | 298 // Returns the exit code of the subprocess. |
| 298 int RunZygote(const MainFunctionParams& main_function_params, | 299 int RunZygote(const MainFunctionParams& main_function_params, |
| 299 ContentMainDelegate* delegate) { | 300 ContentMainDelegate* delegate) { |
| 300 static const MainFunction kMainFunctions[] = { | 301 static const MainFunction kMainFunctions[] = { |
| 301 { switches::kRendererProcess, RendererMain }, | 302 { switches::kRendererProcess, RendererMain }, |
| 302 #if defined(ENABLE_PLUGINS) | 303 #if BUILDFLAG(ENABLE_PLUGINS) |
| 303 { switches::kPpapiPluginProcess, PpapiPluginMain }, | 304 { switches::kPpapiPluginProcess, PpapiPluginMain }, |
| 304 #endif | 305 #endif |
| 305 { switches::kUtilityProcess, UtilityMain }, | 306 { switches::kUtilityProcess, UtilityMain }, |
| 306 }; | 307 }; |
| 307 | 308 |
| 308 ScopedVector<ZygoteForkDelegate> zygote_fork_delegates; | 309 ScopedVector<ZygoteForkDelegate> zygote_fork_delegates; |
| 309 if (delegate) { | 310 if (delegate) { |
| 310 delegate->ZygoteStarting(&zygote_fork_delegates); | 311 delegate->ZygoteStarting(&zygote_fork_delegates); |
| 311 media::InitializeMediaLibrary(); | 312 media::InitializeMediaLibrary(); |
| 312 } | 313 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 // Returns the exit code for this process. | 371 // Returns the exit code for this process. |
| 371 int RunNamedProcessTypeMain( | 372 int RunNamedProcessTypeMain( |
| 372 const std::string& process_type, | 373 const std::string& process_type, |
| 373 const MainFunctionParams& main_function_params, | 374 const MainFunctionParams& main_function_params, |
| 374 ContentMainDelegate* delegate) { | 375 ContentMainDelegate* delegate) { |
| 375 static const MainFunction kMainFunctions[] = { | 376 static const MainFunction kMainFunctions[] = { |
| 376 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 377 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
| 377 { "", BrowserMain }, | 378 { "", BrowserMain }, |
| 378 #endif | 379 #endif |
| 379 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | 380 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 380 #if defined(ENABLE_PLUGINS) | 381 #if BUILDFLAG(ENABLE_PLUGINS) |
| 381 { switches::kPpapiPluginProcess, PpapiPluginMain }, | 382 { switches::kPpapiPluginProcess, PpapiPluginMain }, |
| 382 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, | 383 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, |
| 383 #endif // ENABLE_PLUGINS | 384 #endif // ENABLE_PLUGINS |
| 384 { switches::kUtilityProcess, UtilityMain }, | 385 { switches::kUtilityProcess, UtilityMain }, |
| 385 { switches::kRendererProcess, RendererMain }, | 386 { switches::kRendererProcess, RendererMain }, |
| 386 { switches::kGpuProcess, GpuMain }, | 387 { switches::kGpuProcess, GpuMain }, |
| 387 #endif // !CHROME_MULTIPLE_DLL_BROWSER | 388 #endif // !CHROME_MULTIPLE_DLL_BROWSER |
| 388 }; | 389 }; |
| 389 | 390 |
| 390 RegisterMainThreadFactories(); | 391 RegisterMainThreadFactories(); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 | 831 |
| 831 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 832 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 832 }; | 833 }; |
| 833 | 834 |
| 834 // static | 835 // static |
| 835 ContentMainRunner* ContentMainRunner::Create() { | 836 ContentMainRunner* ContentMainRunner::Create() { |
| 836 return new ContentMainRunnerImpl(); | 837 return new ContentMainRunnerImpl(); |
| 837 } | 838 } |
| 838 | 839 |
| 839 } // namespace content | 840 } // namespace content |
| OLD | NEW |