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

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

Issue 13004012: Implement the host side of the PPB_PDF proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 8 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
« no previous file with comments | « ppapi/proxy/pdf_resource.cc ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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
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
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
OLDNEW
« no previous file with comments | « ppapi/proxy/pdf_resource.cc ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698