diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-09 05:25:31 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-09 05:25:31 +0000 |
commit | 5790d92e12c225bfe1683c81cf223dcf64302d1d (patch) | |
tree | 6f58f7e47ef43377cde1c34b33d6f95b15b67f75 /content | |
parent | eaa60485f027b00047a2e142d9616ede4333a46b (diff) | |
download | chromium_src-5790d92e12c225bfe1683c81cf223dcf64302d1d.zip chromium_src-5790d92e12c225bfe1683c81cf223dcf64302d1d.tar.gz chromium_src-5790d92e12c225bfe1683c81cf223dcf64302d1d.tar.bz2 |
Enable sending requests to pre-cache fonts from pepper plugin processes.
BUG=None
TEST=Pepper Flash should render the text on http://www.adventmedia.net/#/home correctly.
Review URL: http://codereview.chromium.org/8479024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/ppapi_plugin_process_host.cc | 20 | ||||
-rw-r--r-- | content/browser/ppapi_plugin_process_host.h | 10 | ||||
-rw-r--r-- | content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc | 13 |
3 files changed, 36 insertions, 7 deletions
diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc index f123149..89b485b 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc @@ -11,6 +11,7 @@ #include "base/utf_string_conversions.h" #include "content/browser/plugin_service.h" #include "content/browser/renderer_host/render_message_filter.h" +#include "content/common/child_process_messages.h" #include "content/public/common/content_switches.h" #include "content/public/common/pepper_plugin_info.h" #include "ipc/ipc_switches.h" @@ -56,6 +57,10 @@ PpapiPluginProcessHost::~PpapiPluginProcessHost() { DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") << "~PpapiPluginProcessHost()"; CancelRequests(); + +#if defined(OS_WIN) + ReleaseCachedFonts(process_id_); +#endif } PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( @@ -98,13 +103,15 @@ PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver) : BrowserChildProcessHost(ChildProcessInfo::PPAPI_PLUGIN_PROCESS), filter_(new PepperMessageFilter(host_resolver)), network_observer_(new PluginNetworkObserver(this)), - is_broker_(false) { + is_broker_(false), + process_id_(ChildProcessInfo::GenerateChildProcessUniqueId()) { AddFilter(filter_.get()); } PpapiPluginProcessHost::PpapiPluginProcessHost() : BrowserChildProcessHost(ChildProcessInfo::PPAPI_BROKER_PROCESS), - is_broker_(true) { + is_broker_(true), + process_id_(ChildProcessInfo::GenerateChildProcessUniqueId()) { } bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { @@ -203,6 +210,9 @@ bool PpapiPluginProcessHost::OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(PpapiPluginProcessHost, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, OnRendererPluginChannelCreated) +#if defined(OS_WIN) + IPC_MESSAGE_HANDLER(ChildProcessHostMsg_PreCacheFont, OnPreCacheFont) +#endif IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() DCHECK(handled); @@ -280,3 +290,9 @@ void PpapiPluginProcessHost::OnRendererPluginChannelCreated( client->OnChannelOpened(renderers_plugin_handle, channel_handle); } + +#if defined(OS_WIN) +void PpapiPluginProcessHost::OnPreCacheFont(const LOGFONT& font) { + PreCacheFont(font, process_id_); +} +#endif diff --git a/content/browser/ppapi_plugin_process_host.h b/content/browser/ppapi_plugin_process_host.h index 6fb67d5..a8c56a6 100644 --- a/content/browser/ppapi_plugin_process_host.h +++ b/content/browser/ppapi_plugin_process_host.h @@ -8,6 +8,10 @@ #include <queue> +#if defined(OS_WIN) +#include <windows.h> +#endif + #include "base/basictypes.h" #include "base/file_path.h" #include "base/memory/scoped_ptr.h" @@ -93,6 +97,9 @@ class PpapiPluginProcessHost // IPC message handlers. void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle); +#if defined(OS_WIN) + void OnPreCacheFont(const LOGFONT& font); +#endif // Handles most requests from the plugin. May be NULL. scoped_refptr<PepperMessageFilter> filter_; @@ -113,6 +120,9 @@ class PpapiPluginProcessHost const bool is_broker_; + // The unique id created for the process. + int process_id_; + DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost); }; diff --git a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc index 4733909..a2acb57 100644 --- a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc +++ b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc @@ -10,6 +10,9 @@ #include "base/logging.h" #include "base/string16.h" #include "build/build_config.h" +#include "content/common/child_process_messages.h" +#include "content/common/child_thread.h" +#include "ipc/ipc_sync_message_filter.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" @@ -59,11 +62,11 @@ class PpapiWebKitPlatformSupportImpl::SandboxSupport : public WebSandboxSupport bool PpapiWebKitPlatformSupportImpl::SandboxSupport::ensureFontLoaded( HFONT font) { - // TODO(brettw) this should do the something similar to what - // RendererWebKitPlatformSupportImpl does and request that the browser load - // the font. - NOTIMPLEMENTED(); - return false; + LOGFONT logfont; + GetObject(font, sizeof(LOGFONT), &logfont); + + return ChildThread::current()->sync_message_filter()->Send( + new ChildProcessHostMsg_PreCacheFont(logfont)); } #elif defined(OS_MACOSX) |