diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-17 20:15:25 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-17 20:15:25 +0000 |
commit | 7a26d92ecbe0ec01d433a4bc97106b4743c15049 (patch) | |
tree | 8ec52949f54934b188ae3b345f9ecf212435839b /ppapi/proxy | |
parent | 94394dc91c469fe2f851769784e4f2d81e0c9573 (diff) | |
download | chromium_src-7a26d92ecbe0ec01d433a4bc97106b4743c15049.zip chromium_src-7a26d92ecbe0ec01d433a4bc97106b4743c15049.tar.gz chromium_src-7a26d92ecbe0ec01d433a4bc97106b4743c15049.tar.bz2 |
Rename PPB_Font to PPB_BrowserFont_Trusted.
PPB_Font can never be exported to NaCl since it relies on in-process WebKit.
So I'm renaming this to BrowserFont_Trusted to imply that this is the way that
the browser would render fonts in the content area (if we export a font API to
NaCl in the future, it will likely be a simpler native font API).
The new API is binary compatible with the old font API, so I map PPB_Font to
PPB_BrowserFont_Trusted for now to avoid breaking Flash (which uses this). When
we update Flash and push it out, we can remove the mapping and PPB_Font.
This does a lot of cleanup of the font implementation. It had complexity from
the fact that it used to run on a different thread. I was able to remove a lot
of code.
Review URL: https://chromiumcodereview.appspot.com/9360045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122564 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r-- | ppapi/proxy/interface_list.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/plugin_dispatcher.cc | 1 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 6 | ||||
-rw-r--r-- | ppapi/proxy/ppb_font_proxy.cc | 54 | ||||
-rw-r--r-- | ppapi/proxy/ppb_font_proxy.h | 42 | ||||
-rw-r--r-- | ppapi/proxy/ppb_instance_proxy.cc | 17 | ||||
-rw-r--r-- | ppapi/proxy/ppb_instance_proxy.h | 1 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.cc | 24 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.h | 6 |
9 files changed, 35 insertions, 118 deletions
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index ce456ddc..0ff81c2e 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -60,6 +60,7 @@ #include "ppapi/c/private/ppb_tcp_socket_private.h" #include "ppapi/c/private/ppb_udp_socket_private.h" #include "ppapi/c/trusted/ppb_broker_trusted.h" +#include "ppapi/c/trusted/ppb_browser_font_trusted.h" #include "ppapi/c/trusted/ppb_char_set_trusted.h" #include "ppapi/c/trusted/ppb_file_io_trusted.h" #include "ppapi/c/trusted/ppb_url_loader_trusted.h" @@ -80,7 +81,6 @@ #include "ppapi/proxy/ppb_flash_message_loop_proxy.h" #include "ppapi/proxy/ppb_flash_net_connector_proxy.h" #include "ppapi/proxy/ppb_flash_proxy.h" -#include "ppapi/proxy/ppb_font_proxy.h" #include "ppapi/proxy/ppb_graphics_2d_proxy.h" #include "ppapi/proxy/ppb_graphics_3d_proxy.h" #include "ppapi/proxy/ppb_image_data_proxy.h" diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc index bfa7917..3788d40 100644 --- a/ppapi/proxy/plugin_dispatcher.cc +++ b/ppapi/proxy/plugin_dispatcher.cc @@ -21,7 +21,6 @@ #include "ppapi/proxy/plugin_var_serialization_rules.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppb_cursor_control_proxy.h" -#include "ppapi/proxy/ppb_font_proxy.h" #include "ppapi/proxy/ppb_instance_proxy.h" #include "ppapi/proxy/ppp_class_proxy.h" #include "ppapi/proxy/resource_creation_proxy.h" diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 04b812d..1f47a17 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -843,10 +843,6 @@ IPC_MESSAGE_CONTROL3(PpapiHostMsg_PPBUDPSocket_SendTo, IPC_MESSAGE_CONTROL1(PpapiHostMsg_PPBUDPSocket_Close, uint32 /* socket_id */) -// PPB_Font. -IPC_SYNC_MESSAGE_CONTROL0_1(PpapiHostMsg_PPBFont_GetFontFamilies, - std::string /* result */) - // PPB_Graphics2D. IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics2D_Create, PP_Instance /* instance */, @@ -938,6 +934,8 @@ IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBInstance_ExecuteScript, IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBInstance_GetDefaultCharSet, PP_Instance /* instance */, ppapi::proxy::SerializedVar /* result */) +IPC_SYNC_MESSAGE_CONTROL0_1(PpapiHostMsg_PPBInstance_GetFontFamilies, + std::string /* result */) IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBInstance_SetFullscreen, PP_Instance /* instance */, PP_Bool /* fullscreen */, diff --git a/ppapi/proxy/ppb_font_proxy.cc b/ppapi/proxy/ppb_font_proxy.cc deleted file mode 100644 index b12c22e..0000000 --- a/ppapi/proxy/ppb_font_proxy.cc +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/proxy/ppb_font_proxy.h" - -#include "ppapi/c/dev/ppb_font_dev.h" -#include "ppapi/proxy/plugin_dispatcher.h" -#include "ppapi/proxy/plugin_globals.h" -#include "ppapi/proxy/plugin_proxy_delegate.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/var.h" - -using ppapi::thunk::PPB_Font_FunctionAPI; - -namespace ppapi { -namespace proxy { - -PPB_Font_Proxy::PPB_Font_Proxy(Dispatcher* dispatcher) - : InterfaceProxy(dispatcher) { -} - -PPB_Font_Proxy::~PPB_Font_Proxy() { -} - -PPB_Font_FunctionAPI* PPB_Font_Proxy::AsPPB_Font_FunctionAPI() { - return this; -} - -// TODO(ananta) -// This needs to be wired up to the PPAPI plugin code. -PP_Var PPB_Font_Proxy::GetFontFamilies(PP_Instance instance) { - PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); - if (!dispatcher) - return PP_MakeUndefined(); - - // Assume the font families don't change, so we can cache the result globally. - CR_DEFINE_STATIC_LOCAL(std::string, families, ()); - if (families.empty()) { - PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( - new PpapiHostMsg_PPBFont_GetFontFamilies(&families)); - } - - return StringVar::StringToPPVar(families); -} - -bool PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { - // There aren't any font messages. - NOTREACHED(); - return false; -} - -} // namespace proxy -} // namespace ppapi diff --git a/ppapi/proxy/ppb_font_proxy.h b/ppapi/proxy/ppb_font_proxy.h deleted file mode 100644 index 2849f3d..0000000 --- a/ppapi/proxy/ppb_font_proxy.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PPAPI_PROXY_PPB_FONT_PROXY_H_ -#define PPAPI_PROXY_PPB_FONT_PROXY_H_ - -#include "base/callback_forward.h" -#include "ppapi/proxy/interface_proxy.h" -#include "ppapi/shared_impl/function_group_base.h" -#include "ppapi/shared_impl/host_resource.h" -#include "ppapi/shared_impl/resource.h" -#include "ppapi/thunk/ppb_font_api.h" - -namespace ppapi { -namespace proxy { - -class PPB_Font_Proxy : public InterfaceProxy, - public ppapi::thunk::PPB_Font_FunctionAPI { - public: - explicit PPB_Font_Proxy(Dispatcher* dispatcher); - virtual ~PPB_Font_Proxy(); - - // FunctionGroupBase overrides. - virtual ppapi::thunk::PPB_Font_FunctionAPI* AsPPB_Font_FunctionAPI() OVERRIDE; - - // PPB_Font_FunctionAPI implementation. - virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE; - - // InterfaceProxy implementation. - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; - - static const ApiID kApiID = API_ID_PPB_FONT; - - private: - DISALLOW_COPY_AND_ASSIGN(PPB_Font_Proxy); -}; - -} // namespace proxy -} // namespace ppapi - -#endif // PPAPI_PROXY_PPB_FONT_PROXY_H_ diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index 7cc33f0..5bdde43 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -12,11 +12,13 @@ #include "ppapi/proxy/enter_proxy.h" #include "ppapi/proxy/host_dispatcher.h" #include "ppapi/proxy/plugin_dispatcher.h" +#include "ppapi/proxy/plugin_proxy_delegate.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/serialized_var.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/ppb_url_util_shared.h" #include "ppapi/shared_impl/ppb_view_shared.h" +#include "ppapi/shared_impl/var.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/thunk.h" @@ -213,6 +215,21 @@ PP_Bool PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance) { return data->flash_fullscreen; } +PP_Var PPB_Instance_Proxy::GetFontFamilies(PP_Instance instance) { + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); + if (!dispatcher) + return PP_MakeUndefined(); + + // Assume the font families don't change, so we can cache the result globally. + CR_DEFINE_STATIC_LOCAL(std::string, families, ()); + if (families.empty()) { + PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( + new PpapiHostMsg_PPBInstance_GetFontFamilies(&families)); + } + + return StringVar::StringToPPVar(families); +} + PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { PP_Bool result = PP_FALSE; diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h index 71107e4..ba6b2ae 100644 --- a/ppapi/proxy/ppb_instance_proxy.h +++ b/ppapi/proxy/ppb_instance_proxy.h @@ -58,6 +58,7 @@ class PPB_Instance_Proxy : public InterfaceProxy, PP_Bool final_result) OVERRIDE; virtual void SelectedFindResultChanged(PP_Instance instance, int32_t index) OVERRIDE; + virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE; virtual PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) OVERRIDE; virtual PP_Bool GetScreenSize(PP_Instance instance, diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc index 5d8cd4d..731dd60 100644 --- a/ppapi/proxy/resource_creation_proxy.cc +++ b/ppapi/proxy/resource_creation_proxy.cc @@ -21,7 +21,6 @@ #include "ppapi/proxy/ppb_flash_menu_proxy.h" #include "ppapi/proxy/ppb_flash_message_loop_proxy.h" #include "ppapi/proxy/ppb_flash_net_connector_proxy.h" -#include "ppapi/proxy/ppb_font_proxy.h" #include "ppapi/proxy/ppb_graphics_2d_proxy.h" #include "ppapi/proxy/ppb_graphics_3d_proxy.h" #include "ppapi/proxy/ppb_image_data_proxy.h" @@ -37,7 +36,7 @@ #include "ppapi/shared_impl/ppb_input_event_shared.h" #include "ppapi/shared_impl/ppb_resource_array_shared.h" #include "ppapi/shared_impl/ppb_url_request_info_shared.h" -#include "ppapi/shared_impl/private/ppb_font_shared.h" +#include "ppapi/shared_impl/private/ppb_browser_font_trusted_shared.h" #include "ppapi/shared_impl/var.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_image_data_api.h" @@ -105,6 +104,16 @@ PP_Resource ResourceCreationProxy::CreateBroker(PP_Instance instance) { return PPB_Broker_Proxy::CreateProxyResource(instance); } +PP_Resource ResourceCreationProxy::CreateBrowserFont( + PP_Instance instance, + const PP_BrowserFont_Trusted_Description* description) { + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); + if (!dispatcher) + return 0; + return PPB_BrowserFont_Trusted_Shared::Create( + OBJECT_IS_PROXY, instance, *description, dispatcher->preferences()); +} + PP_Resource ResourceCreationProxy::CreateBuffer(PP_Instance instance, uint32_t size) { return PPB_Buffer_Proxy::CreateProxyResource(instance, size); @@ -155,17 +164,6 @@ PP_Resource ResourceCreationProxy::CreateFlashNetConnector( return PPB_Flash_NetConnector_Proxy::CreateProxyResource(instance); } -PP_Resource ResourceCreationProxy::CreateFontObject( - PP_Instance instance, - const PP_FontDescription_Dev* description) { - PluginDispatcher* dispatcher = - PluginDispatcher::GetForInstance(instance); - if (!dispatcher) - return 0; - return PPB_Font_Shared::Create(OBJECT_IS_PROXY, instance, *description, - dispatcher->preferences()); -} - PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance, const PP_Size& size, PP_Bool is_always_opaque) { diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h index d28f153..f508e42 100644 --- a/ppapi/proxy/resource_creation_proxy.h +++ b/ppapi/proxy/resource_creation_proxy.h @@ -53,6 +53,9 @@ class ResourceCreationProxy : public InterfaceProxy, void* user_data) OVERRIDE; virtual PP_Resource CreateAudioInputTrusted(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateBroker(PP_Instance instance) OVERRIDE; + virtual PP_Resource CreateBrowserFont( + PP_Instance instance, + const PP_BrowserFont_Trusted_Description* description) OVERRIDE; virtual PP_Resource CreateBuffer(PP_Instance instance, uint32_t size) OVERRIDE; virtual PP_Resource CreateDirectoryReader(PP_Resource directory_ref) OVERRIDE; @@ -69,9 +72,6 @@ class ResourceCreationProxy : public InterfaceProxy, const PP_Flash_Menu* menu_data) OVERRIDE; virtual PP_Resource CreateFlashMessageLoop(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateFlashNetConnector(PP_Instance instance) OVERRIDE; - virtual PP_Resource CreateFontObject( - PP_Instance instance, - const PP_FontDescription_Dev* description) OVERRIDE; virtual PP_Resource CreateGraphics2D(PP_Instance pp_instance, const PP_Size& size, PP_Bool is_always_opaque) OVERRIDE; |