summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-18 20:46:22 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-18 20:46:22 +0000
commit2559954d36de1e43396327012edc36f806953afc (patch)
tree7e55e3d89b259a53938c1c8865e363f3d7e2471c /ppapi
parentab345fac9c72cd940a554c351032248b1f6f2528 (diff)
downloadchromium_src-2559954d36de1e43396327012edc36f806953afc.zip
chromium_src-2559954d36de1e43396327012edc36f806953afc.tar.gz
chromium_src-2559954d36de1e43396327012edc36f806953afc.tar.bz2
Remove PPB_PDF proxy.
Currently PDF runs in-process only. This old-style proxy actually existed only to serve PPB_Flash_Font_File. However, a real proxy implementation has been written for that interface. The PPB_PDF proxy is being completely rewritten and so this old proxy is no longer needed. BUG=none Review URL: https://chromiumcodereview.appspot.com/12638037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188810 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/cpp/private/flash_font_file.cc20
-rw-r--r--ppapi/ppapi_proxy.gypi2
-rw-r--r--ppapi/proxy/interface_list.cc2
-rw-r--r--ppapi/proxy/ppb_pdf_proxy.cc206
-rw-r--r--ppapi/proxy/ppb_pdf_proxy.h50
5 files changed, 1 insertions, 279 deletions
diff --git a/ppapi/cpp/private/flash_font_file.cc b/ppapi/cpp/private/flash_font_file.cc
index 406f0ac..df11f57 100644
--- a/ppapi/cpp/private/flash_font_file.cc
+++ b/ppapi/cpp/private/flash_font_file.cc
@@ -6,7 +6,6 @@
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/private/ppb_flash_font_file.h"
-#include "ppapi/c/private/ppb_pdf.h"
#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
#include "ppapi/cpp/instance_handle.h"
#include "ppapi/cpp/module_impl.h"
@@ -15,12 +14,6 @@ namespace pp {
namespace {
-// TODO(yzshen): Once PPB_Flash_FontFile gets to the stable channel, we can
-// remove the code of using PPB_PDF in this file.
-template <> const char* interface_name<PPB_PDF>() {
- return PPB_PDF_INTERFACE;
-}
-
template <> const char* interface_name<PPB_Flash_FontFile_0_1>() {
return PPB_FLASH_FONTFILE_INTERFACE_0_1;
}
@@ -38,13 +31,6 @@ FontFile::FontFile(const InstanceHandle& instance,
if (has_interface<PPB_Flash_FontFile_0_1>()) {
PassRefFromConstructor(get_interface<PPB_Flash_FontFile_0_1>()->Create(
instance.pp_instance(), description, charset));
- } else if (has_interface<PPB_PDF>()) {
- // PP_Font_Description_Dev and PP_BrowserFont_Trusted_Description are the
- // same struct so we can call this old interface by casting.
- PassRefFromConstructor(get_interface<PPB_PDF>()->GetFontFileWithFallback(
- instance.pp_instance(),
- reinterpret_cast<const PP_FontDescription_Dev*>(description),
- charset));
}
}
@@ -53,7 +39,7 @@ FontFile::~FontFile() {
// static
bool FontFile::IsAvailable() {
- return has_interface<PPB_Flash_FontFile_0_1>() || has_interface<PPB_PDF>();
+ return has_interface<PPB_Flash_FontFile_0_1>();
}
bool FontFile::GetFontTable(uint32_t table,
@@ -63,10 +49,6 @@ bool FontFile::GetFontTable(uint32_t table,
return !!get_interface<PPB_Flash_FontFile_0_1>()->
GetFontTable(pp_resource(), table, output, output_length);
}
- if (has_interface<PPB_PDF>()) {
- return get_interface<PPB_PDF>()->GetFontTableForPrivateFontFile(
- pp_resource(), table, output, output_length);
- }
return false;
}
diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi
index 4a5df15..9978a42 100644
--- a/ppapi/ppapi_proxy.gypi
+++ b/ppapi/ppapi_proxy.gypi
@@ -113,8 +113,6 @@
'proxy/ppb_message_loop_proxy.h',
'proxy/ppb_network_monitor_private_proxy.cc',
'proxy/ppb_network_monitor_private_proxy.h',
- 'proxy/ppb_pdf_proxy.cc',
- 'proxy/ppb_pdf_proxy.h',
'proxy/ppb_tcp_server_socket_private_proxy.cc',
'proxy/ppb_tcp_server_socket_private_proxy.h',
'proxy/ppb_tcp_socket_private_proxy.cc',
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 9a4fd20..63af5df 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -96,7 +96,6 @@
#include "ppapi/proxy/ppb_instance_proxy.h"
#include "ppapi/proxy/ppb_message_loop_proxy.h"
#include "ppapi/proxy/ppb_network_monitor_private_proxy.h"
-#include "ppapi/proxy/ppb_pdf_proxy.h"
#include "ppapi/proxy/ppb_tcp_server_socket_private_proxy.h"
#include "ppapi/proxy/ppb_tcp_socket_private_proxy.h"
#include "ppapi/proxy/ppb_testing_proxy.h"
@@ -240,7 +239,6 @@ InterfaceList::InterfaceList() {
// Do not add more stuff here, they should be added to interface_list*.h
// TODO(brettw) remove these.
AddPPB(PPB_Instance_Proxy::GetInfoPrivate(), PERMISSION_PRIVATE);
- AddPPB(PPB_PDF_Proxy::GetInfo(), PERMISSION_PRIVATE);
AddPPB(PPB_URLLoader_Proxy::GetTrustedInfo(), PERMISSION_PRIVATE);
AddPPB(PPB_Var_Deprecated_Proxy::GetInfo(), PERMISSION_DEV);
diff --git a/ppapi/proxy/ppb_pdf_proxy.cc b/ppapi/proxy/ppb_pdf_proxy.cc
deleted file mode 100644
index 1deb959..0000000
--- a/ppapi/proxy/ppb_pdf_proxy.cc
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright (c) 2012 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_pdf_proxy.h"
-
-#include <string.h> // For memcpy.
-
-#include <map>
-
-#include "base/logging.h"
-#include "base/memory/linked_ptr.h"
-#include "build/build_config.h"
-#include "ppapi/c/private/ppb_pdf.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_resource_tracker.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/shared_impl/ppapi_globals.h"
-#include "ppapi/shared_impl/proxy_lock.h"
-#include "ppapi/shared_impl/var_tracker.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_pdf_api.h"
-
-using ppapi::thunk::PPB_PDFFont_API;
-using ppapi::thunk::EnterResource;
-
-namespace ppapi {
-namespace proxy {
-
-class PrivateFontFile : public Resource,
- public PPB_PDFFont_API {
- public:
- PrivateFontFile(const HostResource& resource)
- : Resource(OBJECT_IS_PROXY, resource) {
- }
- virtual ~PrivateFontFile() {}
-
- PPB_PDFFont_API* AsPPB_PDFFont_API() { return this; }
-
- // Sees if we have a cache of the font table and returns a pointer to it.
- // Returns NULL if we don't have it.
- std::string* GetFontTable(uint32_t table) const;
-
- std::string* AddFontTable(uint32_t table, const std::string& contents);
-
- private:
- typedef std::map<uint32_t, linked_ptr<std::string> > FontTableMap;
- FontTableMap font_tables_;
-
- DISALLOW_COPY_AND_ASSIGN(PrivateFontFile);
-};
-
-std::string* PrivateFontFile::GetFontTable(uint32_t table) const {
- FontTableMap::const_iterator found = font_tables_.find(table);
- if (found == font_tables_.end())
- return NULL;
- return found->second.get();
-}
-
-std::string* PrivateFontFile::AddFontTable(uint32_t table,
- const std::string& contents) {
- linked_ptr<std::string> heap_string(new std::string(contents));
- font_tables_[table] = heap_string;
- return heap_string.get();
-}
-
-namespace {
-
-PP_Resource GetFontFileWithFallback(
- PP_Instance instance,
- const PP_FontDescription_Dev* description,
- PP_PrivateFontCharset charset) {
- ProxyAutoLock lock;
-
- PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
- if (!dispatcher)
- return 0;
-
- SerializedFontDescription desc;
- desc.SetFromPPFontDescription(*description);
-
- HostResource result;
- dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontFileWithFallback(
- API_ID_PPB_PDF, instance, desc, charset, &result));
- if (result.is_null())
- return 0;
- return (new PrivateFontFile(result))->GetReference();
-}
-
-bool GetFontTableForPrivateFontFile(PP_Resource font_file,
- uint32_t table,
- void* output,
- uint32_t* output_length) {
- EnterResource<PPB_PDFFont_API> enter(font_file, true);
- if (enter.failed())
- return false;
-
- PrivateFontFile* object = static_cast<PrivateFontFile*>(enter.object());
- PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
- object->pp_instance());
- if (!dispatcher)
- return false;
-
- std::string* contents = object->GetFontTable(table);
- if (!contents) {
- std::string deserialized;
- dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile(
- API_ID_PPB_PDF, object->host_resource(), table, &deserialized));
- if (deserialized.empty())
- return false;
- contents = object->AddFontTable(table, deserialized);
- }
-
- *output_length = static_cast<uint32_t>(contents->size());
- if (output)
- memcpy(output, contents->c_str(), *output_length);
- return true;
-}
-
-const PPB_PDF pdf_interface = {
- NULL, // &GetLocalizedString,
- NULL, // &GetResourceImage,
- &GetFontFileWithFallback,
- &GetFontTableForPrivateFontFile,
-};
-
-InterfaceProxy* CreatePDFProxy(Dispatcher* dispatcher) {
- return new PPB_PDF_Proxy(dispatcher);
-}
-
-} // namespace
-
-PPB_PDF_Proxy::PPB_PDF_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppb_pdf_impl_(NULL) {
- if (!dispatcher->IsPlugin()) {
- ppb_pdf_impl_ = static_cast<const PPB_PDF*>(
- dispatcher->local_get_interface()(PPB_PDF_INTERFACE));
- }
-}
-
-PPB_PDF_Proxy::~PPB_PDF_Proxy() {
-}
-
-// static
-const InterfaceProxy::Info* PPB_PDF_Proxy::GetInfo() {
- static const Info info = {
- &pdf_interface,
- PPB_PDF_INTERFACE,
- API_ID_PPB_PDF,
- true,
- &CreatePDFProxy,
- };
- return &info;
-}
-
-bool PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) {
- // This is a private interface, plugin must have permission.
- if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
- return false;
-
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback,
- OnMsgGetFontFileWithFallback)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile,
- OnMsgGetFontTableForPrivateFontFile)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- // TODO(brettw): handle bad messages!
- return handled;
-}
-
-void PPB_PDF_Proxy::OnMsgGetFontFileWithFallback(
- PP_Instance instance,
- const SerializedFontDescription& in_desc,
- int32_t charset,
- HostResource* result) {
- PP_FontDescription_Dev desc;
- in_desc.SetToPPFontDescription(&desc);
- result->SetHostResource(instance,
- ppb_pdf_impl_->GetFontFileWithFallback(
- instance, &desc, static_cast<PP_PrivateFontCharset>(charset)));
-
- // SetToPPFontDescription() creates a var which is owned by the caller.
- PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(desc.face);
-}
-
-void PPB_PDF_Proxy::OnMsgGetFontTableForPrivateFontFile(
- const HostResource& font_file,
- uint32_t table,
- std::string* result) {
- // TODO(brettw): It would be nice not to copy here. At least on Linux,
- // we can map the font file into shared memory and read it that way.
- uint32_t table_length = 0;
- if (!ppb_pdf_impl_->GetFontTableForPrivateFontFile(
- font_file.host_resource(), table, NULL, &table_length))
- return;
-
- result->resize(table_length);
- ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(),
- table, const_cast<char*>(result->c_str()), &table_length);
-}
-
-} // namespace proxy
-} // namespace ppapi
diff --git a/ppapi/proxy/ppb_pdf_proxy.h b/ppapi/proxy/ppb_pdf_proxy.h
deleted file mode 100644
index b676148..0000000
--- a/ppapi/proxy/ppb_pdf_proxy.h
+++ /dev/null
@@ -1,50 +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_PPB_PDF_PROXY_H_
-#define PPAPI_PPB_PDF_PROXY_H_
-
-#include <string>
-
-#include "ppapi/c/pp_module.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/shared_impl/host_resource.h"
-
-struct PPB_PDF;
-
-namespace ppapi {
-namespace proxy {
-
-struct SerializedFontDescription;
-
-class PPB_PDF_Proxy : public InterfaceProxy {
- public:
- PPB_PDF_Proxy(Dispatcher* dispatcher);
- virtual ~PPB_PDF_Proxy();
-
- static const Info* GetInfo();
-
- // InterfaceProxy implementation.
- virtual bool OnMessageReceived(const IPC::Message& msg);
-
- private:
- // Message handlers.
- void OnMsgGetFontFileWithFallback(PP_Module module,
- const SerializedFontDescription& desc,
- int32_t charset,
- ppapi::HostResource* result);
- void OnMsgGetFontTableForPrivateFontFile(const ppapi::HostResource& font_file,
- uint32_t table,
- std::string* result);
-
- // When this proxy is in the host side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the plugin, this value is always NULL.
- const PPB_PDF* ppb_pdf_impl_;
-};
-
-} // namespace proxy
-} // namespace ppapi
-
-#endif // PPAPI_PPB_PDF_PROXY_H_