| 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 "base/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/debug/crash_logging.h" | 7 #include "base/debug/crash_logging.h" |
| 8 #include "base/debug/debugger.h" | 8 #include "base/debug/debugger.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "content/child/child_process.h" | 15 #include "content/child/child_process.h" |
| 16 #include "content/common/content_constants_internal.h" | 16 #include "content/common/content_constants_internal.h" |
| 17 #include "content/common/sandbox_linux/sandbox_linux.h" | 17 #include "content/common/sandbox_linux/sandbox_linux.h" |
| 18 #include "content/ppapi_plugin/ppapi_thread.h" | 18 #include "content/ppapi_plugin/ppapi_thread.h" |
| 19 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
| 20 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
| 21 #include "content/public/common/main_function_params.h" | 21 #include "content/public/common/main_function_params.h" |
| 22 #include "content/public/plugin/content_plugin_client.h" | 22 #include "content/public/plugin/content_plugin_client.h" |
| 23 #include "ipc/ipc_sender.h" |
| 23 #include "ppapi/proxy/plugin_globals.h" | 24 #include "ppapi/proxy/plugin_globals.h" |
| 24 #include "ppapi/proxy/proxy_module.h" | 25 #include "ppapi/proxy/proxy_module.h" |
| 25 #include "ui/base/ui_base_switches.h" | 26 #include "ui/base/ui_base_switches.h" |
| 26 | 27 |
| 27 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 28 #include "base/win/win_util.h" | 29 #include "base/win/win_util.h" |
| 29 #include "base/win/windows_version.h" | 30 #include "base/win/windows_version.h" |
| 30 #include "content/common/font_warmup_win.h" | 31 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h" |
| 31 #include "sandbox/win/src/sandbox.h" | 32 #include "sandbox/win/src/sandbox.h" |
| 32 #include "third_party/WebKit/public/web/win/WebFontRendering.h" | 33 #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
| 33 #include "third_party/skia/include/ports/SkTypeface_win.h" | 34 #include "third_party/skia/include/ports/SkTypeface_win.h" |
| 34 #include "ui/gfx/win/direct_write.h" | 35 #include "ui/gfx/win/direct_write.h" |
| 35 #include "ui/gfx/win/dpi.h" | 36 #include "ui/gfx/win/dpi.h" |
| 36 #endif | 37 #endif |
| 37 | 38 |
| 38 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 39 #include "base/files/file_util.h" | 40 #include "base/files/file_util.h" |
| 40 #endif | 41 #endif |
| (...skipping 15 matching lines...) Expand all Loading... |
| 56 namespace content { | 57 namespace content { |
| 57 | 58 |
| 58 namespace { | 59 namespace { |
| 59 | 60 |
| 60 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
| 61 // Windows-only skia sandbox support | 62 // Windows-only skia sandbox support |
| 62 void SkiaPreCacheFont(const LOGFONT& logfont) { | 63 void SkiaPreCacheFont(const LOGFONT& logfont) { |
| 63 ppapi::proxy::PluginGlobals::Get()->PreCacheFontForFlash( | 64 ppapi::proxy::PluginGlobals::Get()->PreCacheFontForFlash( |
| 64 reinterpret_cast<const void*>(&logfont)); | 65 reinterpret_cast<const void*>(&logfont)); |
| 65 } | 66 } |
| 67 |
| 68 // Helper function so that we can Bind() GetBrowserSender. We can't bind it |
| 69 // as a member function because PluginGlobals is not ref counted. |
| 70 IPC::Sender* GetPluginGlobalsSender() { |
| 71 return ppapi::proxy::PluginGlobals::Get()->GetBrowserSender(); |
| 72 } |
| 73 |
| 66 #endif | 74 #endif |
| 67 | 75 |
| 68 } // namespace | 76 } // namespace |
| 69 | 77 |
| 70 // Main function for starting the PPAPI plugin process. | 78 // Main function for starting the PPAPI plugin process. |
| 71 int PpapiPluginMain(const MainFunctionParams& parameters) { | 79 int PpapiPluginMain(const MainFunctionParams& parameters) { |
| 72 const base::CommandLine& command_line = parameters.command_line; | 80 const base::CommandLine& command_line = parameters.command_line; |
| 73 | 81 |
| 74 #if defined(OS_WIN) | 82 #if defined(OS_WIN) |
| 75 g_target_services = parameters.sandbox_info->target_services; | 83 g_target_services = parameters.sandbox_info->target_services; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 140 |
| 133 ChildProcess ppapi_process; | 141 ChildProcess ppapi_process; |
| 134 ppapi_process.set_main_thread( | 142 ppapi_process.set_main_thread( |
| 135 new PpapiThread(parameters.command_line, false)); // Not a broker. | 143 new PpapiThread(parameters.command_line, false)); // Not a broker. |
| 136 | 144 |
| 137 #if defined(OS_WIN) | 145 #if defined(OS_WIN) |
| 138 if (!base::win::IsUser32AndGdi32Available()) | 146 if (!base::win::IsUser32AndGdi32Available()) |
| 139 gfx::win::MaybeInitializeDirectWrite(); | 147 gfx::win::MaybeInitializeDirectWrite(); |
| 140 bool use_direct_write = gfx::win::IsDirectWriteEnabled(); | 148 bool use_direct_write = gfx::win::IsDirectWriteEnabled(); |
| 141 if (use_direct_write) { | 149 if (use_direct_write) { |
| 142 WarmupDirectWrite(); | 150 InitializeDWriteFontProxy(base::Bind(&GetPluginGlobalsSender)); |
| 143 } else { | 151 } else { |
| 144 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); | 152 SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont); |
| 145 } | 153 } |
| 146 | 154 |
| 147 blink::WebFontRendering::setUseDirectWrite(use_direct_write); | 155 blink::WebFontRendering::setUseDirectWrite(use_direct_write); |
| 148 blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale()); | 156 blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale()); |
| 149 #endif | 157 #endif |
| 150 | 158 |
| 151 main_message_loop.Run(); | 159 main_message_loop.Run(); |
| 152 return 0; | 160 return 0; |
| 153 } | 161 } |
| 154 | 162 |
| 155 } // namespace content | 163 } // namespace content |
| OLD | NEW |