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