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

Side by Side Diff: ppapi/proxy/ppb_pdf_proxy.cc

Issue 10905227: Introduce PPB_Flash_Font. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/ppb_pdf_proxy.h" 5 #include "ppapi/proxy/ppb_pdf_proxy.h"
6 6
7 #include <string.h> // For memcpy. 7 #include <string.h> // For memcpy.
8 8
9 #include <map> 9 #include <map>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/linked_ptr.h" 12 #include "base/memory/linked_ptr.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "ppapi/c/private/ppb_pdf.h" 14 #include "ppapi/c/private/ppb_pdf.h"
15 #include "ppapi/proxy/plugin_dispatcher.h" 15 #include "ppapi/proxy/plugin_dispatcher.h"
16 #include "ppapi/proxy/plugin_resource_tracker.h" 16 #include "ppapi/proxy/plugin_resource_tracker.h"
17 #include "ppapi/proxy/ppapi_messages.h" 17 #include "ppapi/proxy/ppapi_messages.h"
18 #include "ppapi/shared_impl/proxy_lock.h"
18 #include "ppapi/thunk/enter.h" 19 #include "ppapi/thunk/enter.h"
19 #include "ppapi/thunk/ppb_pdf_api.h" 20 #include "ppapi/thunk/ppb_pdf_api.h"
20 21
21 using ppapi::thunk::PPB_PDFFont_API; 22 using ppapi::thunk::PPB_PDFFont_API;
22 using ppapi::thunk::EnterResource; 23 using ppapi::thunk::EnterResource;
23 24
24 namespace ppapi { 25 namespace ppapi {
25 namespace proxy { 26 namespace proxy {
26 27
27 class PrivateFontFile : public Resource, 28 class PrivateFontFile : public Resource,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 font_tables_[table] = heap_string; 61 font_tables_[table] = heap_string;
61 return heap_string.get(); 62 return heap_string.get();
62 } 63 }
63 64
64 namespace { 65 namespace {
65 66
66 PP_Resource GetFontFileWithFallback( 67 PP_Resource GetFontFileWithFallback(
67 PP_Instance instance, 68 PP_Instance instance,
68 const PP_FontDescription_Dev* description, 69 const PP_FontDescription_Dev* description,
69 PP_PrivateFontCharset charset) { 70 PP_PrivateFontCharset charset) {
71 ProxyAutoLock lock;
72
70 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 73 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
71 if (!dispatcher) 74 if (!dispatcher)
72 return 0; 75 return 0;
73 76
74 SerializedFontDescription desc; 77 SerializedFontDescription desc;
75 desc.SetFromPPFontDescription(dispatcher, *description, true); 78 desc.SetFromPPFontDescription(dispatcher, *description, true);
76 79
77 HostResource result; 80 HostResource result;
78 dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontFileWithFallback( 81 dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontFileWithFallback(
79 API_ID_PPB_PDF, instance, desc, charset, &result)); 82 API_ID_PPB_PDF, instance, desc, charset, &result));
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 font_file.host_resource(), table, NULL, &table_length)) 188 font_file.host_resource(), table, NULL, &table_length))
186 return; 189 return;
187 190
188 result->resize(table_length); 191 result->resize(table_length);
189 ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(), 192 ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(),
190 table, const_cast<char*>(result->c_str()), &table_length); 193 table, const_cast<char*>(result->c_str()), &table_length);
191 } 194 }
192 195
193 } // namespace proxy 196 } // namespace proxy
194 } // namespace ppapi 197 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698