Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: content/app/content_main_runner.cc

Issue 10703130: Clean up the remaining diff in content/app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/allocator/allocator_extension.h" 7 #include "base/allocator/allocator_extension.h"
8 #include "base/at_exit.h" 8 #include "base/at_exit.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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 if (process_type == kMainFunctions[i].name) 326 if (process_type == kMainFunctions[i].name)
327 return kMainFunctions[i].function(main_params); 327 return kMainFunctions[i].function(main_params);
328 } 328 }
329 329
330 if (delegate) 330 if (delegate)
331 return delegate->RunProcess(process_type, main_params); 331 return delegate->RunProcess(process_type, main_params);
332 332
333 NOTREACHED() << "Unknown zygote process type: " << process_type; 333 NOTREACHED() << "Unknown zygote process type: " << process_type;
334 return 1; 334 return 1;
335 } 335 }
336 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 336 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
337 337
338 // Run the FooMain() for a given process type. 338 // Run the FooMain() for a given process type.
339 // If |process_type| is empty, runs BrowserMain(). 339 // If |process_type| is empty, runs BrowserMain().
340 // Returns the exit code for this process. 340 // Returns the exit code for this process.
341 int RunNamedProcessTypeMain( 341 int RunNamedProcessTypeMain(
342 const std::string& process_type, 342 const std::string& process_type,
343 const MainFunctionParams& main_function_params, 343 const MainFunctionParams& main_function_params,
344 ContentMainDelegate* delegate) { 344 ContentMainDelegate* delegate) {
345 static const MainFunction kMainFunctions[] = { 345 static const MainFunction kMainFunctions[] = {
346 { "", BrowserMain }, 346 { "", BrowserMain },
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 447
448 // On Android, 448 // On Android,
449 // - setlocale() is not supported. 449 // - setlocale() is not supported.
450 // - We do not override the signal handlers so that we can get 450 // - We do not override the signal handlers so that we can get
451 // stack trace when crashing. 451 // stack trace when crashing.
452 // - The ipc_fd is passed through the Java service. 452 // - The ipc_fd is passed through the Java service.
453 // Thus, these are all disabled. 453 // Thus, these are all disabled.
454 #if !defined(OS_ANDROID) 454 #if !defined(OS_ANDROID)
455 // Set C library locale to make sure CommandLine can parse argument values 455 // Set C library locale to make sure CommandLine can parse argument values
456 // in correct encoding. 456 // in correct encoding.
457 // Android doesn't support this.
Yaron 2012/07/10 21:21:55 These three comments are covered by the block abov
michaelbai 2012/07/10 22:02:42 Done.
457 setlocale(LC_ALL, ""); 458 setlocale(LC_ALL, "");
458 459
460 // On Android, do not override the signal handlers so that we can get stack
461 // trace when crashing.
459 SetupSignalHandlers(); 462 SetupSignalHandlers();
460 463
464 // Android passes the ipc_fd through the Java service.
461 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); 465 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance();
462 g_fds->Set(kPrimaryIPCChannel, 466 g_fds->Set(kPrimaryIPCChannel,
463 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); 467 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor);
464 #endif 468 #endif
465 469
466 #if defined(OS_LINUX) || defined(OS_OPENBSD) 470 #if defined(OS_LINUX) || defined(OS_OPENBSD)
467 g_fds->Set(kCrashDumpSignal, 471 g_fds->Set(kCrashDumpSignal,
468 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); 472 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor);
469 #endif 473 #endif
470 474
471 #endif // !OS_WIN 475 #endif // !OS_WIN
472 476
473 is_initialized_ = true; 477 is_initialized_ = true;
474 delegate_ = delegate; 478 delegate_ = delegate;
475 479
476 base::EnableTerminationOnHeapCorruption(); 480 base::EnableTerminationOnHeapCorruption();
477 base::EnableTerminationOnOutOfMemory(); 481 base::EnableTerminationOnOutOfMemory();
478 482 // In normal chrome, ContentMainRunner::initialize is where the
479 // On Android, AtExitManager is set up when library is loaded. 483 // AtExitManager is registered. In android, we need to do it earlier because
484 // we use LazyInstances very early on and LazyInstance requires
Yaron 2012/07/10 21:21:55 I think the old comment was preferred (i.e. do the
michaelbai 2012/07/10 22:02:42 Done.
485 // AtExitManager.
480 #if !defined(OS_ANDROID) 486 #if !defined(OS_ANDROID)
481 // The exit manager is in charge of calling the dtors of singleton objects. 487 // The exit manager is in charge of calling the dtors of singleton objects.
482 exit_manager_.reset(new base::AtExitManager); 488 exit_manager_.reset(new base::AtExitManager);
483 #endif 489 #endif
484 490
485 #if defined(OS_MACOSX) 491 #if defined(OS_MACOSX)
486 // We need this pool for all the objects created before we get to the 492 // We need this pool for all the objects created before we get to the
487 // event loop, but we don't want to leave them hanging around until the 493 // event loop, but we don't want to leave them hanging around until the
488 // app quits. Each "main" needs to flush this pool right before it goes into 494 // app quits. Each "main" needs to flush this pool right before it goes into
489 // its main event loop to get rid of the cruft. 495 // its main event loop to get rid of the cruft.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 688
683 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 689 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
684 }; 690 };
685 691
686 // static 692 // static
687 ContentMainRunner* ContentMainRunner::Create() { 693 ContentMainRunner* ContentMainRunner::Create() {
688 return new ContentMainRunnerImpl(); 694 return new ContentMainRunnerImpl();
689 } 695 }
690 696
691 } // namespace content 697 } // namespace content
OLDNEW
« content/app/android/library_loader_hooks.cc ('K') | « content/app/android/library_loader_hooks.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698