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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 104 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
105 #include "content/zygote/zygote_main.h" | 105 #include "content/zygote/zygote_main.h" |
106 #endif | 106 #endif |
107 | 107 |
108 #endif // OS_POSIX | 108 #endif // OS_POSIX |
109 | 109 |
110 #if defined(USE_NSS_CERTS) | 110 #if defined(USE_NSS_CERTS) |
111 #include "crypto/nss_util.h" | 111 #include "crypto/nss_util.h" |
112 #endif | 112 #endif |
113 | 113 |
| 114 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 115 #include "content/common/media/cdm_host_files.h" |
| 116 #endif |
| 117 |
114 namespace content { | 118 namespace content { |
115 extern int GpuMain(const content::MainFunctionParams&); | 119 extern int GpuMain(const content::MainFunctionParams&); |
116 #if BUILDFLAG(ENABLE_PLUGINS) | 120 #if BUILDFLAG(ENABLE_PLUGINS) |
117 #if !defined(OS_LINUX) | 121 #if !defined(OS_LINUX) |
118 extern int PluginMain(const content::MainFunctionParams&); | 122 extern int PluginMain(const content::MainFunctionParams&); |
119 #endif | 123 #endif |
120 extern int PpapiPluginMain(const MainFunctionParams&); | 124 extern int PpapiPluginMain(const MainFunctionParams&); |
121 extern int PpapiBrokerMain(const MainFunctionParams&); | 125 extern int PpapiBrokerMain(const MainFunctionParams&); |
122 #endif | 126 #endif |
123 extern int RendererMain(const content::MainFunctionParams&); | 127 extern int RendererMain(const content::MainFunctionParams&); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 if (delegate) delegate->ZygoteForked(); | 330 if (delegate) delegate->ZygoteForked(); |
327 | 331 |
328 // Zygote::HandleForkRequest may have reallocated the command | 332 // Zygote::HandleForkRequest may have reallocated the command |
329 // line so update it here with the new version. | 333 // line so update it here with the new version. |
330 const base::CommandLine& command_line = | 334 const base::CommandLine& command_line = |
331 *base::CommandLine::ForCurrentProcess(); | 335 *base::CommandLine::ForCurrentProcess(); |
332 std::string process_type = | 336 std::string process_type = |
333 command_line.GetSwitchValueASCII(switches::kProcessType); | 337 command_line.GetSwitchValueASCII(switches::kProcessType); |
334 ContentClientInitializer::Set(process_type, delegate); | 338 ContentClientInitializer::Set(process_type, delegate); |
335 | 339 |
| 340 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 341 if (process_type != switches::kPpapiPluginProcess) { |
| 342 DVLOG(1) << "Closing CDM files for non-ppapi process."; |
| 343 CdmHostFiles::TakeGlobalInstance().reset(); |
| 344 } else { |
| 345 DVLOG(1) << "Not closing CDM files for ppapi process."; |
| 346 } |
| 347 #endif |
| 348 |
336 MainFunctionParams main_params(command_line); | 349 MainFunctionParams main_params(command_line); |
337 main_params.zygote_child = true; | 350 main_params.zygote_child = true; |
338 | 351 |
339 std::unique_ptr<base::FieldTrialList> field_trial_list; | 352 std::unique_ptr<base::FieldTrialList> field_trial_list; |
340 InitializeFieldTrialAndFeatureList(&field_trial_list); | 353 InitializeFieldTrialAndFeatureList(&field_trial_list); |
341 | 354 |
342 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { | 355 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { |
343 if (process_type == kMainFunctions[i].name) | 356 if (process_type == kMainFunctions[i].name) |
344 return kMainFunctions[i].function(main_params); | 357 return kMainFunctions[i].function(main_params); |
345 } | 358 } |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 | 866 |
854 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 867 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
855 }; | 868 }; |
856 | 869 |
857 // static | 870 // static |
858 ContentMainRunner* ContentMainRunner::Create() { | 871 ContentMainRunner* ContentMainRunner::Create() { |
859 return new ContentMainRunnerImpl(); | 872 return new ContentMainRunnerImpl(); |
860 } | 873 } |
861 | 874 |
862 } // namespace content | 875 } // namespace content |
OLD | NEW |