Chromium Code Reviews| 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 <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" | 50 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
| 54 #include <cstring> | 54 #include <cstring> |
| 55 #include <atlbase.h> | 55 #include <atlbase.h> |
| 56 #include <atlapp.h> | 56 #include <atlapp.h> |
| 57 #include <malloc.h> | 57 #include <malloc.h> |
| 58 #elif defined(OS_MACOSX) | 58 #elif defined(OS_MACOSX) |
| 59 #include "base/mac/scoped_nsautorelease_pool.h" | 59 #include "base/mac/scoped_nsautorelease_pool.h" |
| 60 #if !defined(OS_IOS) | |
| 60 #include "base/mach_ipc_mac.h" | 61 #include "base/mach_ipc_mac.h" |
| 61 #include "base/system_monitor/system_monitor.h" | 62 #include "base/system_monitor/system_monitor.h" |
| 62 #include "content/browser/mach_broker_mac.h" | 63 #include "content/browser/mach_broker_mac.h" |
| 63 #include "content/common/sandbox_init_mac.h" | 64 #include "content/common/sandbox_init_mac.h" |
| 65 #endif // !OS_IOS | |
| 64 #endif // OS_WIN | 66 #endif // OS_WIN |
| 65 | 67 |
| 66 #if defined(OS_POSIX) | 68 #if defined(OS_POSIX) |
| 67 #include <signal.h> | 69 #include <signal.h> |
| 68 | 70 |
| 69 #include "base/global_descriptors_posix.h" | 71 #include "base/global_descriptors_posix.h" |
| 70 #include "content/public/common/content_descriptors.h" | 72 #include "content/public/common/content_descriptors.h" |
| 71 | 73 |
| 72 #if !defined(OS_MACOSX) | 74 #if !defined(OS_MACOSX) |
| 73 #include "content/public/common/zygote_fork_delegate_linux.h" | 75 #include "content/public/common/zygote_fork_delegate_linux.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 103 g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; | 105 g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; |
| 104 base::LazyInstance<ContentRendererClient> | 106 base::LazyInstance<ContentRendererClient> |
| 105 g_empty_content_renderer_client = LAZY_INSTANCE_INITIALIZER; | 107 g_empty_content_renderer_client = LAZY_INSTANCE_INITIALIZER; |
| 106 base::LazyInstance<ContentUtilityClient> | 108 base::LazyInstance<ContentUtilityClient> |
| 107 g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER; | 109 g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER; |
| 108 | 110 |
| 109 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
| 110 | 112 |
| 111 static CAppModule _Module; | 113 static CAppModule _Module; |
| 112 | 114 |
| 113 #elif defined(OS_MACOSX) | 115 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 114 | 116 |
| 115 // Completes the Mach IPC handshake by sending this process' task port to the | 117 // Completes the Mach IPC handshake by sending this process' task port to the |
| 116 // parent process. The parent is listening on the Mach port given by | 118 // parent process. The parent is listening on the Mach port given by |
| 117 // |GetMachPortName()|. The task port is used by the parent to get CPU/memory | 119 // |GetMachPortName()|. The task port is used by the parent to get CPU/memory |
| 118 // stats to display in the task manager. | 120 // stats to display in the task manager. |
| 119 void SendTaskPortToParentProcess() { | 121 void SendTaskPortToParentProcess() { |
| 120 const mach_msg_timeout_t kTimeoutMs = 100; | 122 const mach_msg_timeout_t kTimeoutMs = 100; |
| 121 const int32_t kMessageId = 0; | 123 const int32_t kMessageId = 0; |
| 122 std::string mach_port_name = MachBroker::GetMachPortName(); | 124 std::string mach_port_name = MachBroker::GetMachPortName(); |
| 123 | 125 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 // when presenting them to the user), reset the locale for numeric | 182 // when presenting them to the user), reset the locale for numeric |
| 181 // formatting. | 183 // formatting. |
| 182 // Note that this is not correct for plugin processes -- they can | 184 // Note that this is not correct for plugin processes -- they can |
| 183 // surface UI -- but it's likely they get this wrong too so why not. | 185 // surface UI -- but it's likely they get this wrong too so why not. |
| 184 setlocale(LC_NUMERIC, "C"); | 186 setlocale(LC_NUMERIC, "C"); |
| 185 #endif | 187 #endif |
| 186 } | 188 } |
| 187 | 189 |
| 188 static base::ProcessId GetBrowserPid(const CommandLine& command_line) { | 190 static base::ProcessId GetBrowserPid(const CommandLine& command_line) { |
| 189 base::ProcessId browser_pid = base::GetCurrentProcId(); | 191 base::ProcessId browser_pid = base::GetCurrentProcId(); |
| 192 #if !defined(OS_IOS) | |
| 190 if (command_line.HasSwitch(switches::kProcessChannelID)) { | 193 if (command_line.HasSwitch(switches::kProcessChannelID)) { |
| 191 #if defined(OS_WIN) || defined(OS_MACOSX) | 194 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 192 std::string channel_name = | 195 std::string channel_name = |
| 193 command_line.GetSwitchValueASCII(switches::kProcessChannelID); | 196 command_line.GetSwitchValueASCII(switches::kProcessChannelID); |
| 194 | 197 |
| 195 int browser_pid_int; | 198 int browser_pid_int; |
| 196 base::StringToInt(channel_name, &browser_pid_int); | 199 base::StringToInt(channel_name, &browser_pid_int); |
| 197 browser_pid = static_cast<base::ProcessId>(browser_pid_int); | 200 browser_pid = static_cast<base::ProcessId>(browser_pid_int); |
| 198 DCHECK_NE(browser_pid_int, 0); | 201 DCHECK_NE(browser_pid_int, 0); |
| 199 #elif defined(OS_ANDROID) | 202 #elif defined(OS_ANDROID) |
| 200 // On Android, the browser process isn't the parent. A bunch | 203 // On Android, the browser process isn't the parent. A bunch |
| 201 // of work will be required before callers of this routine will | 204 // of work will be required before callers of this routine will |
| 202 // get what they want. | 205 // get what they want. |
| 203 // | 206 // |
| 204 // Note: On Linux, base::GetParentProcessId() is defined in | 207 // Note: On Linux, base::GetParentProcessId() is defined in |
| 205 // process_util_linux.cc. Note that *_linux.cc is excluded from | 208 // process_util_linux.cc. Note that *_linux.cc is excluded from |
| 206 // Android builds but a special exception is made in base.gypi | 209 // Android builds but a special exception is made in base.gypi |
| 207 // for a few files including process_util_linux.cc. | 210 // for a few files including process_util_linux.cc. |
| 208 LOG(ERROR) << "GetBrowserPid() not implemented for Android()."; | 211 LOG(ERROR) << "GetBrowserPid() not implemented for Android()."; |
| 209 #elif defined(OS_POSIX) | 212 #elif defined(OS_POSIX) |
| 210 // On linux, we're in a process forked from the zygote here; so we need the | 213 // On linux, we're in a process forked from the zygote here; so we need the |
| 211 // parent's parent process' id. | 214 // parent's parent process' id. |
| 212 browser_pid = | 215 browser_pid = |
| 213 base::GetParentProcessId( | 216 base::GetParentProcessId( |
| 214 base::GetParentProcessId(base::GetCurrentProcId())); | 217 base::GetParentProcessId(base::GetCurrentProcId())); |
| 215 #endif | 218 #endif |
| 216 } | 219 } |
| 220 #endif // !OS_IOS | |
| 217 return browser_pid; | 221 return browser_pid; |
| 218 } | 222 } |
| 219 | 223 |
| 220 static void InitializeStatsTable(const CommandLine& command_line) { | 224 static void InitializeStatsTable(const CommandLine& command_line) { |
| 221 // Initialize the Stats Counters table. With this initialized, | 225 // Initialize the Stats Counters table. With this initialized, |
| 222 // the StatsViewer can be utilized to read counters outside of | 226 // the StatsViewer can be utilized to read counters outside of |
| 223 // Chrome. These lines can be commented out to effectively turn | 227 // Chrome. These lines can be commented out to effectively turn |
| 224 // counters 'off'. The table is created and exists for the life | 228 // counters 'off'. The table is created and exists for the life |
| 225 // of the process. It is not cleaned up. | 229 // of the process. It is not cleaned up. |
| 226 if (command_line.HasSwitch(switches::kEnableStatsTable)) { | 230 if (command_line.HasSwitch(switches::kEnableStatsTable)) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 } | 339 } |
| 336 | 340 |
| 337 if (delegate) | 341 if (delegate) |
| 338 return delegate->RunProcess(process_type, main_params); | 342 return delegate->RunProcess(process_type, main_params); |
| 339 | 343 |
| 340 NOTREACHED() << "Unknown zygote process type: " << process_type; | 344 NOTREACHED() << "Unknown zygote process type: " << process_type; |
| 341 return 1; | 345 return 1; |
| 342 } | 346 } |
| 343 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 347 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 344 | 348 |
| 349 #if !defined(OS_IOS) | |
| 345 // Run the FooMain() for a given process type. | 350 // Run the FooMain() for a given process type. |
| 346 // If |process_type| is empty, runs BrowserMain(). | 351 // If |process_type| is empty, runs BrowserMain(). |
| 347 // Returns the exit code for this process. | 352 // Returns the exit code for this process. |
| 348 int RunNamedProcessTypeMain( | 353 int RunNamedProcessTypeMain( |
| 349 const std::string& process_type, | 354 const std::string& process_type, |
| 350 const MainFunctionParams& main_function_params, | 355 const MainFunctionParams& main_function_params, |
| 351 ContentMainDelegate* delegate) { | 356 ContentMainDelegate* delegate) { |
| 357 // None of the *Main processes exist on iOS. | |
|
jam
2012/09/05 15:34:15
nit: get rid of this added line
leng
2012/09/06 08:43:18
Done.
| |
| 352 static const MainFunction kMainFunctions[] = { | 358 static const MainFunction kMainFunctions[] = { |
| 353 { "", BrowserMain }, | 359 { "", BrowserMain }, |
| 354 { switches::kRendererProcess, RendererMain }, | 360 { switches::kRendererProcess, RendererMain }, |
| 355 { switches::kPluginProcess, PluginMain }, | 361 { switches::kPluginProcess, PluginMain }, |
| 356 { switches::kWorkerProcess, WorkerMain }, | 362 { switches::kWorkerProcess, WorkerMain }, |
| 357 { switches::kPpapiPluginProcess, PpapiPluginMain }, | 363 { switches::kPpapiPluginProcess, PpapiPluginMain }, |
| 358 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, | 364 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, |
| 359 { switches::kUtilityProcess, UtilityMain }, | 365 { switches::kUtilityProcess, UtilityMain }, |
| 360 { switches::kGpuProcess, GpuMain }, | 366 { switches::kGpuProcess, GpuMain }, |
| 361 }; | 367 }; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 387 return RunZygote(main_function_params, delegate); | 393 return RunZygote(main_function_params, delegate); |
| 388 #endif | 394 #endif |
| 389 | 395 |
| 390 // If it's a process we don't know about, the embedder should know. | 396 // If it's a process we don't know about, the embedder should know. |
| 391 if (delegate) | 397 if (delegate) |
| 392 return delegate->RunProcess(process_type, main_function_params); | 398 return delegate->RunProcess(process_type, main_function_params); |
| 393 | 399 |
| 394 NOTREACHED() << "Unknown process type: " << process_type; | 400 NOTREACHED() << "Unknown process type: " << process_type; |
| 395 return 1; | 401 return 1; |
| 396 } | 402 } |
| 403 #endif // !OS_IOS | |
| 397 | 404 |
| 398 class ContentMainRunnerImpl : public ContentMainRunner { | 405 class ContentMainRunnerImpl : public ContentMainRunner { |
| 399 public: | 406 public: |
| 400 ContentMainRunnerImpl() | 407 ContentMainRunnerImpl() |
| 401 : is_initialized_(false), | 408 : is_initialized_(false), |
| 402 is_shutdown_(false), | 409 is_shutdown_(false), |
| 403 completed_basic_startup_(false), | 410 completed_basic_startup_(false), |
| 404 delegate_(NULL) { | 411 delegate_(NULL) { |
| 405 #if defined(OS_WIN) | 412 #if defined(OS_WIN) |
| 406 memset(&sandbox_info_, 0, sizeof(sandbox_info_)); | 413 memset(&sandbox_info_, 0, sizeof(sandbox_info_)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 tracked_objects::TIME_SOURCE_TYPE_TCMALLOC); | 472 tracked_objects::TIME_SOURCE_TYPE_TCMALLOC); |
| 466 } | 473 } |
| 467 #endif | 474 #endif |
| 468 | 475 |
| 469 // On Android, | 476 // On Android, |
| 470 // - setlocale() is not supported. | 477 // - setlocale() is not supported. |
| 471 // - We do not override the signal handlers so that we can get | 478 // - We do not override the signal handlers so that we can get |
| 472 // stack trace when crashing. | 479 // stack trace when crashing. |
| 473 // - The ipc_fd is passed through the Java service. | 480 // - The ipc_fd is passed through the Java service. |
| 474 // Thus, these are all disabled. | 481 // Thus, these are all disabled. |
| 475 #if !defined(OS_ANDROID) | 482 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 476 // Set C library locale to make sure CommandLine can parse argument values | 483 // Set C library locale to make sure CommandLine can parse argument values |
| 477 // in correct encoding. | 484 // in correct encoding. |
| 478 setlocale(LC_ALL, ""); | 485 setlocale(LC_ALL, ""); |
| 479 | 486 |
| 480 SetupSignalHandlers(); | 487 SetupSignalHandlers(); |
| 481 | 488 |
| 482 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); | 489 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); |
| 483 g_fds->Set(kPrimaryIPCChannel, | 490 g_fds->Set(kPrimaryIPCChannel, |
| 484 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); | 491 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); |
| 485 #endif | 492 |
| 493 // On Android, AtExitManager is set up when library is loaded. | |
| 494 // On iOS, it's set up in main(), which can't call directly through to here. | |
| 495 // The exit manager is in charge of calling the dtors of singleton objects. | |
|
jam
2012/09/05 15:34:15
nit: I would put this line first in the comment, o
leng
2012/09/06 08:43:18
Done.
| |
| 496 exit_manager_.reset(new base::AtExitManager); | |
| 497 | |
| 498 #endif // !OS_ANDROID && !OS_IOS | |
| 486 | 499 |
| 487 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 500 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
| 488 g_fds->Set(kCrashDumpSignal, | 501 g_fds->Set(kCrashDumpSignal, |
| 489 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); | 502 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); |
| 490 #endif | 503 #endif |
| 491 | 504 |
| 492 #endif // !OS_WIN | 505 #endif // !OS_WIN |
| 493 | 506 |
| 494 is_initialized_ = true; | 507 is_initialized_ = true; |
| 495 delegate_ = delegate; | 508 delegate_ = delegate; |
| 496 | 509 |
| 497 base::EnableTerminationOnHeapCorruption(); | 510 base::EnableTerminationOnHeapCorruption(); |
| 498 base::EnableTerminationOnOutOfMemory(); | 511 base::EnableTerminationOnOutOfMemory(); |
| 499 | 512 |
| 500 // On Android, AtExitManager is set up when library is loaded. | |
| 501 #if !defined(OS_ANDROID) | |
| 502 // The exit manager is in charge of calling the dtors of singleton objects. | |
| 503 exit_manager_.reset(new base::AtExitManager); | |
| 504 #endif | |
| 505 | |
| 506 #if defined(OS_MACOSX) | 513 #if defined(OS_MACOSX) |
| 507 // We need this pool for all the objects created before we get to the | 514 // We need this pool for all the objects created before we get to the |
| 508 // event loop, but we don't want to leave them hanging around until the | 515 // event loop, but we don't want to leave them hanging around until the |
| 509 // app quits. Each "main" needs to flush this pool right before it goes into | 516 // app quits. Each "main" needs to flush this pool right before it goes into |
| 510 // its main event loop to get rid of the cruft. | 517 // its main event loop to get rid of the cruft. |
| 511 autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); | 518 autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); |
| 512 #endif | 519 #endif |
| 513 | 520 |
| 514 // On Android, the command line is initialized when library is loaded. | 521 // On Android, the command line is initialized when library is loaded. |
| 515 #if !defined(OS_ANDROID) | 522 #if !defined(OS_ANDROID) |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 536 base::RouteStdioToConsole(); | 543 base::RouteStdioToConsole(); |
| 537 #endif | 544 #endif |
| 538 | 545 |
| 539 // Enable startup tracing asap to avoid early TRACE_EVENT calls being | 546 // Enable startup tracing asap to avoid early TRACE_EVENT calls being |
| 540 // ignored. | 547 // ignored. |
| 541 if (command_line.HasSwitch(switches::kTraceStartup)) { | 548 if (command_line.HasSwitch(switches::kTraceStartup)) { |
| 542 base::debug::TraceLog::GetInstance()->SetEnabled( | 549 base::debug::TraceLog::GetInstance()->SetEnabled( |
| 543 command_line.GetSwitchValueASCII(switches::kTraceStartup)); | 550 command_line.GetSwitchValueASCII(switches::kTraceStartup)); |
| 544 } | 551 } |
| 545 | 552 |
| 546 #if defined(OS_MACOSX) | 553 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 547 // We need to allocate the IO Ports before the Sandbox is initialized or | 554 // We need to allocate the IO Ports before the Sandbox is initialized or |
| 548 // the first instance of SystemMonitor is created. | 555 // the first instance of SystemMonitor is created. |
| 549 // It's important not to allocate the ports for processes which don't | 556 // It's important not to allocate the ports for processes which don't |
| 550 // register with the system monitor - see crbug.com/88867. | 557 // register with the system monitor - see crbug.com/88867. |
| 551 if (process_type.empty() || | 558 if (process_type.empty() || |
| 552 process_type == switches::kPluginProcess || | 559 process_type == switches::kPluginProcess || |
| 553 process_type == switches::kRendererProcess || | 560 process_type == switches::kRendererProcess || |
| 554 process_type == switches::kUtilityProcess || | 561 process_type == switches::kUtilityProcess || |
| 555 process_type == switches::kWorkerProcess || | 562 process_type == switches::kWorkerProcess || |
| 556 (delegate && | 563 (delegate && |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 608 if (command_line.HasSwitch(switches::kUserAgent)) { | 615 if (command_line.HasSwitch(switches::kUserAgent)) { |
| 609 webkit_glue::SetUserAgent( | 616 webkit_glue::SetUserAgent( |
| 610 command_line.GetSwitchValueASCII(switches::kUserAgent), true); | 617 command_line.GetSwitchValueASCII(switches::kUserAgent), true); |
| 611 } | 618 } |
| 612 | 619 |
| 613 if (!process_type.empty()) | 620 if (!process_type.empty()) |
| 614 CommonSubprocessInit(process_type); | 621 CommonSubprocessInit(process_type); |
| 615 | 622 |
| 616 #if defined(OS_WIN) | 623 #if defined(OS_WIN) |
| 617 CHECK(InitializeSandbox(sandbox_info)); | 624 CHECK(InitializeSandbox(sandbox_info)); |
| 618 #elif defined(OS_MACOSX) | 625 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 619 if (process_type == switches::kRendererProcess || | 626 if (process_type == switches::kRendererProcess || |
| 620 process_type == switches::kPpapiPluginProcess || | 627 process_type == switches::kPpapiPluginProcess || |
| 621 (delegate && delegate->DelaySandboxInitialization(process_type))) { | 628 (delegate && delegate->DelaySandboxInitialization(process_type))) { |
| 622 // On OS X the renderer sandbox needs to be initialized later in the | 629 // On OS X the renderer sandbox needs to be initialized later in the |
| 623 // startup sequence in RendererMainPlatformDelegate::EnableSandbox(). | 630 // startup sequence in RendererMainPlatformDelegate::EnableSandbox(). |
| 624 } else { | 631 } else { |
| 625 CHECK(InitializeSandbox()); | 632 CHECK(InitializeSandbox()); |
| 626 } | 633 } |
| 627 #endif | 634 #endif |
| 628 | 635 |
| 629 if (delegate) | 636 if (delegate) |
| 630 delegate->SandboxInitialized(process_type); | 637 delegate->SandboxInitialized(process_type); |
| 631 | 638 |
| 632 #if defined(OS_POSIX) | 639 #if defined(OS_POSIX) && !defined(OS_IOS) |
| 633 SetProcessTitleFromCommandLine(argv); | 640 SetProcessTitleFromCommandLine(argv); |
| 634 #endif | 641 #endif |
| 635 | 642 |
| 636 // Return -1 to indicate no early termination. | 643 // Return -1 to indicate no early termination. |
| 637 return -1; | 644 return -1; |
| 638 } | 645 } |
| 639 | 646 |
| 640 virtual int Run() OVERRIDE { | 647 virtual int Run() OVERRIDE { |
| 641 DCHECK(is_initialized_); | 648 DCHECK(is_initialized_); |
| 642 DCHECK(!is_shutdown_); | 649 DCHECK(!is_shutdown_); |
| 643 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 650 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 644 std::string process_type = | 651 std::string process_type = |
| 645 command_line.GetSwitchValueASCII(switches::kProcessType); | 652 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 646 | 653 |
| 647 MainFunctionParams main_params(command_line); | 654 MainFunctionParams main_params(command_line); |
| 648 #if defined(OS_WIN) | 655 #if defined(OS_WIN) |
| 649 main_params.sandbox_info = &sandbox_info_; | 656 main_params.sandbox_info = &sandbox_info_; |
| 650 #elif defined(OS_MACOSX) | 657 #elif defined(OS_MACOSX) |
| 651 main_params.autorelease_pool = autorelease_pool_.get(); | 658 main_params.autorelease_pool = autorelease_pool_.get(); |
| 652 #endif | 659 #endif |
| 653 | 660 |
| 661 #if !defined(OS_IOS) | |
|
leng
2012/09/05 11:57:11
Had to add this because the whole function is if-d
| |
| 654 return RunNamedProcessTypeMain(process_type, main_params, delegate_); | 662 return RunNamedProcessTypeMain(process_type, main_params, delegate_); |
| 663 #else | |
| 664 return 1; | |
| 665 #endif | |
| 655 } | 666 } |
| 656 | 667 |
| 657 virtual void Shutdown() OVERRIDE { | 668 virtual void Shutdown() OVERRIDE { |
| 658 DCHECK(is_initialized_); | 669 DCHECK(is_initialized_); |
| 659 DCHECK(!is_shutdown_); | 670 DCHECK(!is_shutdown_); |
| 660 | 671 |
| 661 if (completed_basic_startup_ && delegate_) { | 672 if (completed_basic_startup_ && delegate_) { |
| 662 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 673 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 663 std::string process_type = | 674 std::string process_type = |
| 664 command_line.GetSwitchValueASCII(switches::kProcessType); | 675 command_line.GetSwitchValueASCII(switches::kProcessType); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 | 720 |
| 710 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 721 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 711 }; | 722 }; |
| 712 | 723 |
| 713 // static | 724 // static |
| 714 ContentMainRunner* ContentMainRunner::Create() { | 725 ContentMainRunner* ContentMainRunner::Create() { |
| 715 return new ContentMainRunnerImpl(); | 726 return new ContentMainRunnerImpl(); |
| 716 } | 727 } |
| 717 | 728 |
| 718 } // namespace content | 729 } // namespace content |
| OLD | NEW |