| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/ppapi_plugin_process_host.h" | 5 #include "content/browser/ppapi_plugin_process_host.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 PpapiPluginProcessHost* const process_host_; | 54 PpapiPluginProcessHost* const process_host_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 PpapiPluginProcessHost::~PpapiPluginProcessHost() { | 57 PpapiPluginProcessHost::~PpapiPluginProcessHost() { |
| 58 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") | 58 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") |
| 59 << "~PpapiPluginProcessHost()"; | 59 << "~PpapiPluginProcessHost()"; |
| 60 CancelRequests(); | 60 CancelRequests(); |
| 61 | |
| 62 #if defined(OS_WIN) | |
| 63 ReleaseCachedFonts(process_id_); | |
| 64 #endif | |
| 65 } | 61 } |
| 66 | 62 |
| 67 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( | 63 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( |
| 68 const content::PepperPluginInfo& info, | 64 const content::PepperPluginInfo& info, |
| 69 net::HostResolver* host_resolver) { | 65 net::HostResolver* host_resolver) { |
| 70 PpapiPluginProcessHost* plugin_host = | 66 PpapiPluginProcessHost* plugin_host = |
| 71 new PpapiPluginProcessHost(host_resolver); | 67 new PpapiPluginProcessHost(host_resolver); |
| 72 if(plugin_host->Init(info)) | 68 if(plugin_host->Init(info)) |
| 73 return plugin_host; | 69 return plugin_host; |
| 74 | 70 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 204 } |
| 209 | 205 |
| 210 void PpapiPluginProcessHost::OnProcessLaunched() { | 206 void PpapiPluginProcessHost::OnProcessLaunched() { |
| 211 } | 207 } |
| 212 | 208 |
| 213 bool PpapiPluginProcessHost::OnMessageReceived(const IPC::Message& msg) { | 209 bool PpapiPluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 214 bool handled = true; | 210 bool handled = true; |
| 215 IPC_BEGIN_MESSAGE_MAP(PpapiPluginProcessHost, msg) | 211 IPC_BEGIN_MESSAGE_MAP(PpapiPluginProcessHost, msg) |
| 216 IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, | 212 IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, |
| 217 OnRendererPluginChannelCreated) | 213 OnRendererPluginChannelCreated) |
| 218 #if defined(OS_WIN) | |
| 219 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_PreCacheFont, OnPreCacheFont) | |
| 220 #endif | |
| 221 IPC_MESSAGE_UNHANDLED(handled = false) | 214 IPC_MESSAGE_UNHANDLED(handled = false) |
| 222 IPC_END_MESSAGE_MAP() | 215 IPC_END_MESSAGE_MAP() |
| 223 DCHECK(handled); | 216 DCHECK(handled); |
| 224 return handled; | 217 return handled; |
| 225 } | 218 } |
| 226 | 219 |
| 227 // Called when the browser <--> plugin channel has been established. | 220 // Called when the browser <--> plugin channel has been established. |
| 228 void PpapiPluginProcessHost::OnChannelConnected(int32 peer_pid) { | 221 void PpapiPluginProcessHost::OnChannelConnected(int32 peer_pid) { |
| 229 BrowserChildProcessHost::OnChannelConnected(peer_pid); | 222 BrowserChildProcessHost::OnChannelConnected(peer_pid); |
| 230 // This will actually load the plugin. Errors will actually not be reported | 223 // This will actually load the plugin. Errors will actually not be reported |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 ::DuplicateHandle(::GetCurrentProcess(), plugin_process, | 281 ::DuplicateHandle(::GetCurrentProcess(), plugin_process, |
| 289 renderer_process, &renderers_plugin_handle, | 282 renderer_process, &renderers_plugin_handle, |
| 290 0, FALSE, DUPLICATE_SAME_ACCESS); | 283 0, FALSE, DUPLICATE_SAME_ACCESS); |
| 291 #elif defined(OS_POSIX) | 284 #elif defined(OS_POSIX) |
| 292 // Don't need to duplicate anything on POSIX since it's just a PID. | 285 // Don't need to duplicate anything on POSIX since it's just a PID. |
| 293 base::ProcessHandle renderers_plugin_handle = plugin_process; | 286 base::ProcessHandle renderers_plugin_handle = plugin_process; |
| 294 #endif | 287 #endif |
| 295 | 288 |
| 296 client->OnChannelOpened(renderers_plugin_handle, channel_handle); | 289 client->OnChannelOpened(renderers_plugin_handle, channel_handle); |
| 297 } | 290 } |
| 298 | |
| 299 #if defined(OS_WIN) | |
| 300 void PpapiPluginProcessHost::OnPreCacheFont(const LOGFONT& font) { | |
| 301 PreCacheFont(font, process_id_); | |
| 302 } | |
| 303 #endif | |
| OLD | NEW |