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

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

Issue 9950141: Mac: OOP font loading should run on FILE thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test 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
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 91f37aeb4b48f70cf6959402a2dab79dc91330a0..00a84ad38b6dd86ca249c53e6d95149baf74fa1f 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -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 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
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,25 +552,29 @@ void RenderMessageFilter::OnCookiesEnabled(
#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;
+
+ 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);
}
-
- *handle_size = font_data_size;
- font_data.GiveToProcess(base::GetCurrentProcessHandle(), handle);
+ ViewHostMsg_LoadFont::WriteReplyParams(
+ reply, result->font_data_size, handle, result->font_id);
+ Send(reply);
}
#endif // OS_MACOSX
« 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