Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Unified Diff: content/browser/renderer_host/render_message_filter.cc

Issue 10052006: Merge 131324 - Mac: OOP font loading should run on FILE thread. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1084/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_message_filter.h ('k') | content/common/mac/font_loader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_message_filter.cc
===================================================================
--- content/browser/renderer_host/render_message_filter.cc (revision 131698)
+++ content/browser/renderer_host/render_message_filter.cc (working copy)
@@ -63,7 +63,6 @@
#if defined(OS_MACOSX)
#include "content/common/mac/font_descriptor.h"
-#include "content/common/mac/font_loader.h"
#endif
#if defined(OS_POSIX)
#include "base/file_descriptor_posix.h"
@@ -348,7 +347,7 @@
IPC_MESSAGE_HANDLER(ViewHostMsg_DeleteCookie, OnDeleteCookie)
IPC_MESSAGE_HANDLER(ViewHostMsg_CookiesEnabled, OnCookiesEnabled)
#if defined(OS_MACOSX)
- IPC_MESSAGE_HANDLER(ViewHostMsg_LoadFont, OnLoadFont)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_LoadFont, OnLoadFont)
#endif
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPlugins, OnGetPlugins)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetPluginInfo, OnGetPluginInfo)
@@ -553,26 +552,30 @@
#if defined(OS_MACOSX)
void RenderMessageFilter::OnLoadFont(const FontDescriptor& font,
- uint32* handle_size,
- base::SharedMemoryHandle* handle,
- uint32* font_id) {
- base::SharedMemory font_data;
- uint32 font_data_size = 0;
- bool ok = FontLoader::LoadFontIntoBuffer(font.ToNSFont(), &font_data,
- &font_data_size, font_id);
- if (!ok || font_data_size == 0 || *font_id == 0) {
- LOG(ERROR) << "Couldn't load font data for " << font.font_name <<
- " ok=" << ok << " font_data_size=" << font_data_size <<
- " font id=" << *font_id;
- *handle_size = 0;
- *handle = base::SharedMemory::NULLHandle();
- *font_id = 0;
- return;
- }
+ IPC::Message* reply_msg) {
+ FontLoader::Result* result = new FontLoader::Result;
- *handle_size = font_data_size;
- font_data.GiveToProcess(base::GetCurrentProcessHandle(), handle);
+ BrowserThread::PostTaskAndReply(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(&FontLoader::LoadFont, font, result),
+ base::Bind(&RenderMessageFilter::SendLoadFontReply, this, reply_msg,
+ base::Owned(result)));
}
+
+void RenderMessageFilter::SendLoadFontReply(IPC::Message* reply,
+ FontLoader::Result* result) {
+ base::SharedMemoryHandle handle;
+ if (result->font_data_size == 0 || result->font_id == 0) {
+ result->font_data_size = 0;
+ result->font_id = 0;
+ handle = base::SharedMemory::NULLHandle();
+ } else {
+ result->font_data.GiveToProcess(base::GetCurrentProcessHandle(), &handle);
+ }
+ ViewHostMsg_LoadFont::WriteReplyParams(
+ reply, result->font_data_size, handle, result->font_id);
+ Send(reply);
+}
#endif // OS_MACOSX
void RenderMessageFilter::OnGetPlugins(
« no previous file with comments | « content/browser/renderer_host/render_message_filter.h ('k') | content/common/mac/font_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698