| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/pepper/pepper_pdf_host.h" | 5 #include "chrome/renderer/pepper/pepper_pdf_host.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 9 #include "chrome/renderer/printing/print_web_view_helper.h" | 9 #include "chrome/renderer/printing/print_web_view_helper.h" |
| 10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 &image_data_desc, | 311 &image_data_desc, |
| 312 &image_handle, | 312 &image_handle, |
| 313 &byte_count); | 313 &byte_count); |
| 314 ppapi::ScopedPPResource image_data_resource( | 314 ppapi::ScopedPPResource image_data_resource( |
| 315 ppapi::ScopedPPResource::PassRef(), host_resource.host_resource()); | 315 ppapi::ScopedPPResource::PassRef(), host_resource.host_resource()); |
| 316 if (!success) | 316 if (!success) |
| 317 return PP_ERROR_FAILED; | 317 return PP_ERROR_FAILED; |
| 318 | 318 |
| 319 ppapi::host::ReplyMessageContext reply_context = | 319 ppapi::host::ReplyMessageContext reply_context = |
| 320 context->MakeReplyMessageContext(); | 320 context->MakeReplyMessageContext(); |
| 321 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) | 321 #if defined(TOOLKIT_GTK) |
| 322 // For GTK, we pass the SysV shared memory key in the message. |
| 323 PpapiPluginMsg_PDF_GetResourceImageReply reply_msg(host_resource, |
| 324 image_data_desc, |
| 325 image_handle.fd); |
| 326 #elif defined(OS_POSIX) || defined(OS_WIN) |
| 322 ppapi::proxy::SerializedHandle serialized_handle; | 327 ppapi::proxy::SerializedHandle serialized_handle; |
| 323 PpapiPluginMsg_PDF_GetResourceImageReply reply_msg(host_resource, | 328 PpapiPluginMsg_PDF_GetResourceImageReply reply_msg(host_resource, |
| 324 image_data_desc, | 329 image_data_desc, |
| 325 0); | 330 0); |
| 326 serialized_handle.set_shmem(image_handle, byte_count); | 331 serialized_handle.set_shmem(image_handle, byte_count); |
| 327 reply_context.params.AppendHandle(serialized_handle); | 332 reply_context.params.AppendHandle(serialized_handle); |
| 328 #elif defined(OS_LINUX) | |
| 329 // For Linux, we pass the SysV shared memory key in the message. | |
| 330 PpapiPluginMsg_PDF_GetResourceImageReply reply_msg(host_resource, | |
| 331 image_data_desc, | |
| 332 image_handle.fd); | |
| 333 #else | 333 #else |
| 334 // Not supported on the other platforms. | 334 // Not supported on the other platforms. |
| 335 // This is a stub reply_msg not to break the build. | 335 // This is a stub reply_msg not to break the build. |
| 336 PpapiPluginMsg_PDF_GetResourceImageReply reply_msg(host_resource, | 336 PpapiPluginMsg_PDF_GetResourceImageReply reply_msg(host_resource, |
| 337 image_data_desc, | 337 image_data_desc, |
| 338 0); | 338 0); |
| 339 NOTIMPLEMENTED(); | 339 NOTIMPLEMENTED(); |
| 340 return PP_ERROR_NOTSUPPORTED; | 340 return PP_ERROR_NOTSUPPORTED; |
| 341 #endif | 341 #endif |
| 342 | 342 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 386 |
| 387 skia::PlatformCanvas* canvas = image_data->GetPlatformCanvas(); | 387 skia::PlatformCanvas* canvas = image_data->GetPlatformCanvas(); |
| 388 // Note: Do not skBitmap::copyTo the canvas bitmap directly because it will | 388 // Note: Do not skBitmap::copyTo the canvas bitmap directly because it will |
| 389 // ignore the allocated pixels in shared memory and re-allocate a new buffer. | 389 // ignore the allocated pixels in shared memory and re-allocate a new buffer. |
| 390 canvas->writePixels(pixels_to_write, 0, 0); | 390 canvas->writePixels(pixels_to_write, 0, 0); |
| 391 | 391 |
| 392 return true; | 392 return true; |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace chrome | 395 } // namespace chrome |
| OLD | NEW |