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

Side by Side Diff: chrome/renderer/chrome_ppb_pdf_impl.cc

Issue 8341052: share all the needed linux code with OpenBSD in chrome and content (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebased due to LOG macro changes Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/renderer/chrome_ppb_pdf_impl.h" 5 #include "chrome/renderer/chrome_ppb_pdf_impl.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
(...skipping 25 matching lines...) Expand all
36 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" 36 #include "webkit/plugins/ppapi/ppb_image_data_impl.h"
37 37
38 using ppapi::PpapiGlobals; 38 using ppapi::PpapiGlobals;
39 using webkit::ppapi::HostGlobals; 39 using webkit::ppapi::HostGlobals;
40 using webkit::ppapi::PluginInstance; 40 using webkit::ppapi::PluginInstance;
41 using WebKit::WebView; 41 using WebKit::WebView;
42 using content::RenderThread; 42 using content::RenderThread;
43 43
44 namespace chrome { 44 namespace chrome {
45 45
46 #if defined(OS_LINUX) 46 #if defined(OS_LINUX) || defined(OS_OPENBSD)
47 class PrivateFontFile : public ppapi::Resource { 47 class PrivateFontFile : public ppapi::Resource {
48 public: 48 public:
49 PrivateFontFile(PP_Instance instance, int fd) : Resource(instance), fd_(fd) { 49 PrivateFontFile(PP_Instance instance, int fd) : Resource(instance), fd_(fd) {
50 } 50 }
51 virtual ~PrivateFontFile() { 51 virtual ~PrivateFontFile() {
52 } 52 }
53 53
54 bool GetFontTable(uint32_t table, 54 bool GetFontTable(uint32_t table,
55 void* output, 55 void* output,
56 uint32_t* output_length) { 56 uint32_t* output_length) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // ignore the allocated pixels in shared memory and re-allocate a new buffer. 180 // ignore the allocated pixels in shared memory and re-allocate a new buffer.
181 skia::GetTopDevice(*canvas)->writePixels(*res_bitmap, 0, 0); 181 skia::GetTopDevice(*canvas)->writePixels(*res_bitmap, 0, 0);
182 182
183 return image_data->GetReference(); 183 return image_data->GetReference();
184 } 184 }
185 185
186 PP_Resource GetFontFileWithFallback( 186 PP_Resource GetFontFileWithFallback(
187 PP_Instance instance_id, 187 PP_Instance instance_id,
188 const PP_FontDescription_Dev* description, 188 const PP_FontDescription_Dev* description,
189 PP_PrivateFontCharset charset) { 189 PP_PrivateFontCharset charset) {
190 #if defined(OS_LINUX) 190 #if defined(OS_LINUX) || defined(OS_OPENBSD)
191 // Validate the instance before using it below. 191 // Validate the instance before using it below.
192 if (!HostGlobals::Get()->GetInstance(instance_id)) 192 if (!HostGlobals::Get()->GetInstance(instance_id))
193 return 0; 193 return 0;
194 194
195 scoped_refptr<ppapi::StringVar> face_name(ppapi::StringVar::FromPPVar( 195 scoped_refptr<ppapi::StringVar> face_name(ppapi::StringVar::FromPPVar(
196 description->face)); 196 description->face));
197 if (!face_name) 197 if (!face_name)
198 return 0; 198 return 0;
199 199
200 int fd = content::MatchFontWithFallback( 200 int fd = content::MatchFontWithFallback(
(...skipping 11 matching lines...) Expand all
212 // For trusted PPAPI plugins, this is only needed in Linux since font loading 212 // For trusted PPAPI plugins, this is only needed in Linux since font loading
213 // on Windows and Mac works through the renderer sandbox. 213 // on Windows and Mac works through the renderer sandbox.
214 return 0; 214 return 0;
215 #endif 215 #endif
216 } 216 }
217 217
218 bool GetFontTableForPrivateFontFile(PP_Resource font_file, 218 bool GetFontTableForPrivateFontFile(PP_Resource font_file,
219 uint32_t table, 219 uint32_t table,
220 void* output, 220 void* output,
221 uint32_t* output_length) { 221 uint32_t* output_length) {
222 #if defined(OS_LINUX) 222 #if defined(OS_LINUX) || defined(OS_OPENBSD)
223 ppapi::Resource* resource = 223 ppapi::Resource* resource =
224 PpapiGlobals::Get()->GetResourceTracker()->GetResource(font_file); 224 PpapiGlobals::Get()->GetResourceTracker()->GetResource(font_file);
225 if (!resource) 225 if (!resource)
226 return false; 226 return false;
227 227
228 PrivateFontFile* font = static_cast<PrivateFontFile*>(resource); 228 PrivateFontFile* font = static_cast<PrivateFontFile*>(resource);
229 return font->GetFontTable(table, output, output_length); 229 return font->GetFontTable(table, output, output_length);
230 #else 230 #else
231 return false; 231 return false;
232 #endif 232 #endif
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 &SaveAs 351 &SaveAs
352 }; 352 };
353 353
354 // static 354 // static
355 const PPB_PDF* PPB_PDF_Impl::GetInterface() { 355 const PPB_PDF* PPB_PDF_Impl::GetInterface() {
356 return &ppb_pdf; 356 return &ppb_pdf;
357 } 357 }
358 358
359 } // namespace chrome 359 } // namespace chrome
360 360
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698