| 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 377 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 378 std::string process_type = | 378 std::string process_type = |
| 379 command_line.GetSwitchValueASCII(switches::kProcessType); | 379 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 380 ContentClientInitializer::Set(process_type, delegate); | 380 ContentClientInitializer::Set(process_type, delegate); |
| 381 | 381 |
| 382 // If a custom user agent was passed on the command line, we need | 382 // If a custom user agent was passed on the command line, we need |
| 383 // to (re)set it now, rather than using the default one the zygote | 383 // to (re)set it now, rather than using the default one the zygote |
| 384 // initialized. | 384 // initialized. |
| 385 if (command_line.HasSwitch(switches::kUserAgent)) { | 385 if (command_line.HasSwitch(switches::kUserAgent)) { |
| 386 webkit_glue::SetUserAgent( | 386 webkit_glue::SetUserAgent( |
| 387 command_line.GetSwitchValueASCII(switches::kUserAgent), true); | 387 command_line.GetSwitchValueASCII(switches::kUserAgent)); |
| 388 } | 388 } |
| 389 | 389 |
| 390 // The StatsTable must be initialized in each process; we already | 390 // The StatsTable must be initialized in each process; we already |
| 391 // initialized for the browser process, now we need to initialize | 391 // initialized for the browser process, now we need to initialize |
| 392 // within the new processes as well. | 392 // within the new processes as well. |
| 393 InitializeStatsTable(command_line); | 393 InitializeStatsTable(command_line); |
| 394 | 394 |
| 395 MainFunctionParams main_params(command_line); | 395 MainFunctionParams main_params(command_line); |
| 396 | 396 |
| 397 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { | 397 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 InitializeStatsTable(command_line); | 739 InitializeStatsTable(command_line); |
| 740 | 740 |
| 741 if (delegate) | 741 if (delegate) |
| 742 delegate->PreSandboxStartup(); | 742 delegate->PreSandboxStartup(); |
| 743 | 743 |
| 744 // Set any custom user agent passed on the command line now so the string | 744 // Set any custom user agent passed on the command line now so the string |
| 745 // doesn't change between calls to webkit_glue::GetUserAgent(), otherwise it | 745 // doesn't change between calls to webkit_glue::GetUserAgent(), otherwise it |
| 746 // defaults to the user agent set during SetContentClient(). | 746 // defaults to the user agent set during SetContentClient(). |
| 747 if (command_line.HasSwitch(switches::kUserAgent)) { | 747 if (command_line.HasSwitch(switches::kUserAgent)) { |
| 748 webkit_glue::SetUserAgent( | 748 webkit_glue::SetUserAgent( |
| 749 command_line.GetSwitchValueASCII(switches::kUserAgent), true); | 749 command_line.GetSwitchValueASCII(switches::kUserAgent)); |
| 750 } | 750 } |
| 751 | 751 |
| 752 if (!process_type.empty()) | 752 if (!process_type.empty()) |
| 753 CommonSubprocessInit(process_type); | 753 CommonSubprocessInit(process_type); |
| 754 | 754 |
| 755 #if defined(OS_WIN) | 755 #if defined(OS_WIN) |
| 756 CHECK(InitializeSandbox(sandbox_info)); | 756 CHECK(InitializeSandbox(sandbox_info)); |
| 757 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 757 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 758 if (process_type == switches::kRendererProcess || | 758 if (process_type == switches::kRendererProcess || |
| 759 process_type == switches::kPpapiPluginProcess || | 759 process_type == switches::kPpapiPluginProcess || |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 | 852 |
| 853 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 853 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 854 }; | 854 }; |
| 855 | 855 |
| 856 // static | 856 // static |
| 857 ContentMainRunner* ContentMainRunner::Create() { | 857 ContentMainRunner* ContentMainRunner::Create() { |
| 858 return new ContentMainRunnerImpl(); | 858 return new ContentMainRunnerImpl(); |
| 859 } | 859 } |
| 860 | 860 |
| 861 } // namespace content | 861 } // namespace content |
| OLD | NEW |