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 "content/app/content_main.h" | 5 #include "content/app/content_main.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 // Get the new process type from the new command line. | 256 // Get the new process type from the new command line. |
257 std::string process_type = | 257 std::string process_type = |
258 command_line.GetSwitchValueASCII(switches::kProcessType); | 258 command_line.GetSwitchValueASCII(switches::kProcessType); |
259 | 259 |
260 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { | 260 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { |
261 if (process_type == kMainFunctions[i].name) | 261 if (process_type == kMainFunctions[i].name) |
262 return kMainFunctions[i].function(main_params); | 262 return kMainFunctions[i].function(main_params); |
263 } | 263 } |
264 | 264 |
265 if (delegate) | 265 if (delegate) |
266 return delegate->RunProcess(process_type, main_function_params); | 266 return delegate->RunProcess(process_type, main_params); |
267 | 267 |
268 NOTREACHED() << "Unknown zygote process type: " << process_type; | 268 NOTREACHED() << "Unknown zygote process type: " << process_type; |
269 return 1; | 269 return 1; |
270 } | 270 } |
271 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 271 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
272 | 272 |
273 // Run the FooMain() for a given process type. | 273 // Run the FooMain() for a given process type. |
274 // If |process_type| is empty, runs BrowserMain(). | 274 // If |process_type| is empty, runs BrowserMain(). |
275 // Returns the exit code for this process. | 275 // Returns the exit code for this process. |
276 int RunNamedProcessTypeMain(const std::string& process_type, | 276 int RunNamedProcessTypeMain(const std::string& process_type, |
(...skipping 13 matching lines...) Expand all Loading... | |
290 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { | 290 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { |
291 if (process_type == kMainFunctions[i].name) | 291 if (process_type == kMainFunctions[i].name) |
292 return kMainFunctions[i].function(main_function_params); | 292 return kMainFunctions[i].function(main_function_params); |
293 } | 293 } |
294 | 294 |
295 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 295 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
296 // Zygote startup is special -- see RunZygote comments above | 296 // Zygote startup is special -- see RunZygote comments above |
297 // for why we don't use ZygoteMain directly. | 297 // for why we don't use ZygoteMain directly. |
298 if (process_type == switches::kZygoteProcess) | 298 if (process_type == switches::kZygoteProcess) |
299 return RunZygote(main_function_params, delegate); | 299 return RunZygote(main_function_params, delegate); |
300 } | |
jam
2011/09/09 16:49:40
accident?
James Cook
2011/09/09 16:51:08
Yup, thanks.
| |
300 #endif | 301 #endif |
301 | 302 |
302 // If it's a process we don't know about, the embedder should know. | 303 // If it's a process we don't know about, the embedder should know. |
303 if (delegate) | 304 if (delegate) |
304 return delegate->RunProcess(process_type, main_function_params); | 305 return delegate->RunProcess(process_type, main_function_params); |
305 | 306 |
306 NOTREACHED() << "Unknown process type: " << process_type; | 307 NOTREACHED() << "Unknown process type: " << process_type; |
307 return 1; | 308 return 1; |
308 } | 309 } |
309 | 310 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 _CrtDumpMemoryLeaks(); | 489 _CrtDumpMemoryLeaks(); |
489 #endif // _CRTDBG_MAP_ALLOC | 490 #endif // _CRTDBG_MAP_ALLOC |
490 | 491 |
491 _Module.Term(); | 492 _Module.Term(); |
492 #endif // OS_WIN | 493 #endif // OS_WIN |
493 | 494 |
494 return exit_code; | 495 return exit_code; |
495 } | 496 } |
496 | 497 |
497 } // namespace content | 498 } // namespace content |
OLD | NEW |