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