| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "app/hi_res_timer_manager.h" | 7 #include "app/hi_res_timer_manager.h" |
| 8 #include "app/system_monitor.h" | 8 #include "app/system_monitor.h" |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include "app/win_util.h" | 10 #include "app/win_util.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/app/breakpad_linux.h" | 32 #include "chrome/app/breakpad_linux.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
| 36 // Removes our Carbon library interposing from the environment so that it | 36 // Removes our Carbon library interposing from the environment so that it |
| 37 // doesn't carry into any processes that plugins might start. | 37 // doesn't carry into any processes that plugins might start. |
| 38 void TrimInterposeEnvironment(); | 38 void TrimInterposeEnvironment(); |
| 39 | 39 |
| 40 // Initializes the global Cocoa application object. | 40 // Initializes the global Cocoa application object. |
| 41 void InitializeChromeApplication(); | 41 void InitializeChromeApplication(); |
| 42 #endif // OS_MACOSX | 42 #elif defined(OS_LINUX) |
| 43 // Work around an unimplemented instruction in 64-bit Flash. |
| 44 void WorkaroundFlashLAHF(); |
| 45 #endif |
| 43 | 46 |
| 44 // main() routine for running as the plugin process. | 47 // main() routine for running as the plugin process. |
| 45 int PluginMain(const MainFunctionParams& parameters) { | 48 int PluginMain(const MainFunctionParams& parameters) { |
| 46 #if defined(USE_LINUX_BREAKPAD) | 49 #if defined(USE_LINUX_BREAKPAD) |
| 47 // Needs to be called after we have chrome::DIR_USER_DATA. | 50 // Needs to be called after we have chrome::DIR_USER_DATA. |
| 48 InitCrashReporter(); | 51 InitCrashReporter(); |
| 49 #endif | 52 #endif |
| 50 | 53 |
| 51 // The main thread of the plugin services UI. | 54 // The main thread of the plugin services UI. |
| 52 #if defined(OS_MACOSX) | 55 #if defined(OS_MACOSX) |
| 53 TrimInterposeEnvironment(); | 56 TrimInterposeEnvironment(); |
| 54 InitializeChromeApplication(); | 57 InitializeChromeApplication(); |
| 55 #endif | 58 #endif |
| 56 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 59 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
| 57 std::wstring app_name = chrome::kBrowserAppName; | 60 std::wstring app_name = chrome::kBrowserAppName; |
| 58 PlatformThread::SetName(WideToASCII(app_name + L"_PluginMain").c_str()); | 61 PlatformThread::SetName(WideToASCII(app_name + L"_PluginMain").c_str()); |
| 59 | 62 |
| 60 SystemMonitor system_monitor; | 63 SystemMonitor system_monitor; |
| 61 HighResolutionTimerManager high_resolution_timer_manager; | 64 HighResolutionTimerManager high_resolution_timer_manager; |
| 62 | 65 |
| 63 const CommandLine& parsed_command_line = parameters.command_line_; | 66 const CommandLine& parsed_command_line = parameters.command_line_; |
| 64 | 67 |
| 65 #if defined(OS_LINUX) | 68 #if defined(OS_LINUX) |
| 66 // On Linux we exec ourselves from /proc/self/exe, but that makes the | 69 // On Linux we exec ourselves from /proc/self/exe, but that makes the |
| 67 // process name that shows up in "ps" etc. for plugins show as "exe" | 70 // process name that shows up in "ps" etc. for plugins show as "exe" |
| 68 // instead of "chrome" or something reasonable. Try to fix it. | 71 // instead of "chrome" or something reasonable. Try to fix it. |
| 69 CommandLine::SetProcTitle(); | 72 CommandLine::SetProcTitle(); |
| 73 |
| 74 #if defined(ARCH_CPU_64_BITS) |
| 75 WorkaroundFlashLAHF(); |
| 76 #endif |
| 77 |
| 70 #elif defined(OS_WIN) | 78 #elif defined(OS_WIN) |
| 71 sandbox::TargetServices* target_services = | 79 sandbox::TargetServices* target_services = |
| 72 parameters.sandbox_info_.TargetServices(); | 80 parameters.sandbox_info_.TargetServices(); |
| 73 | 81 |
| 74 CoInitialize(NULL); | 82 CoInitialize(NULL); |
| 75 DLOG(INFO) << "Started plugin with " << | 83 DLOG(INFO) << "Started plugin with " << |
| 76 parsed_command_line.command_line_string(); | 84 parsed_command_line.command_line_string(); |
| 77 | 85 |
| 78 HMODULE sandbox_test_module = NULL; | 86 HMODULE sandbox_test_module = NULL; |
| 79 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox) || | 87 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox) || |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 130 |
| 123 MessageLoop::current()->Run(); | 131 MessageLoop::current()->Run(); |
| 124 } | 132 } |
| 125 | 133 |
| 126 #if defined(OS_WIN) | 134 #if defined(OS_WIN) |
| 127 CoUninitialize(); | 135 CoUninitialize(); |
| 128 #endif | 136 #endif |
| 129 | 137 |
| 130 return 0; | 138 return 0; |
| 131 } | 139 } |
| OLD | NEW |