| OLD | NEW |
| 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 <cstring> | 5 #include <cstring> |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "ppapi/c/dev/ppb_memory_dev.h" | 8 #include "ppapi/c/dev/ppb_memory_dev.h" |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/ppb_image_data.h" | 10 #include "ppapi/c/ppb_image_data.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 PP_ImageDataDesc expected_desc = { | 164 PP_ImageDataDesc expected_desc = { |
| 165 PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 165 PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
| 166 { 5, 10 }, | 166 { 5, 10 }, |
| 167 20, | 167 20, |
| 168 }; | 168 }; |
| 169 std::string image_data_desc; | 169 std::string image_data_desc; |
| 170 image_data_desc.resize(sizeof(PP_ImageDataDesc)); | 170 image_data_desc.resize(sizeof(PP_ImageDataDesc)); |
| 171 memcpy(&image_data_desc[0], &expected_desc, sizeof(PP_ImageDataDesc)); | 171 memcpy(&image_data_desc[0], &expected_desc, sizeof(PP_ImageDataDesc)); |
| 172 SerializedHandle serialized_handle(SerializedHandle::SHARED_MEMORY); | 172 SerializedHandle serialized_handle(SerializedHandle::SHARED_MEMORY); |
| 173 PpapiPluginMsg_PDF_GetResourceImageReply reply_msg(expected_resource, | 173 PpapiPluginMsg_PDF_GetResourceImageReply reply_msg(expected_resource, |
| 174 image_data_desc); | 174 image_data_desc, |
| 175 0); |
| 175 ResourceSyncCallHandler handler( | 176 ResourceSyncCallHandler handler( |
| 176 &sink(), | 177 &sink(), |
| 177 PpapiHostMsg_PDF_GetResourceImage::ID, | 178 PpapiHostMsg_PDF_GetResourceImage::ID, |
| 178 PP_OK, | 179 PP_OK, |
| 179 reply_msg); | 180 reply_msg); |
| 180 handler.set_serialized_handle(&serialized_handle); | 181 handler.set_serialized_handle(&serialized_handle); |
| 181 sink().AddFilter(&handler); | 182 sink().AddFilter(&handler); |
| 182 | 183 |
| 183 PP_Resource resource = pdf_iface->GetResourceImageForScale(pp_instance(), | 184 PP_Resource resource = pdf_iface->GetResourceImageForScale(pp_instance(), |
| 184 PP_RESOURCEIMAGE_PDF_BUTTON_FTP, 1.0f); | 185 PP_RESOURCEIMAGE_PDF_BUTTON_FTP, 1.0f); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 200 | 201 |
| 201 resource_tracker->ReleaseResource(resource); | 202 resource_tracker->ReleaseResource(resource); |
| 202 } | 203 } |
| 203 | 204 |
| 204 // Remove the filter or it will be destroyed before the sink() is destroyed. | 205 // Remove the filter or it will be destroyed before the sink() is destroyed. |
| 205 sink().RemoveFilter(&handler); | 206 sink().RemoveFilter(&handler); |
| 206 } | 207 } |
| 207 | 208 |
| 208 } // namespace proxy | 209 } // namespace proxy |
| 209 } // namespace ppapi | 210 } // namespace ppapi |
| OLD | NEW |