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

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

Issue 552423003: PPAPI: Make CallWhileUnlocked more permissive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 "ppapi/proxy/ppp_printing_proxy.h" 5 #include "ppapi/proxy/ppp_printing_proxy.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "ppapi/c/dev/ppp_printing_dev.h" 9 #include "ppapi/c/dev/ppp_printing_dev.h"
10 #include "ppapi/proxy/host_dispatcher.h" 10 #include "ppapi/proxy/host_dispatcher.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 void PPP_Printing_Proxy::OnPluginMsgBegin(PP_Instance instance, 160 void PPP_Printing_Proxy::OnPluginMsgBegin(PP_Instance instance,
161 const std::string& settings_string, 161 const std::string& settings_string,
162 int32_t* result) { 162 int32_t* result) {
163 *result = 0; 163 *result = 0;
164 164
165 PP_PrintSettings_Dev settings; 165 PP_PrintSettings_Dev settings;
166 if (settings_string.size() != sizeof(settings)) 166 if (settings_string.size() != sizeof(settings))
167 return; 167 return;
168 memcpy(&settings, &settings_string[0], sizeof(settings)); 168 memcpy(&settings, &settings_string[0], sizeof(settings));
169 169
170 if (ppp_printing_impl_) { 170 if (ppp_printing_impl_)
171 *result = CallWhileUnlocked(ppp_printing_impl_->Begin, 171 *result = CallWhileUnlocked(ppp_printing_impl_->Begin, instance, &settings);
172 instance,
173 const_cast<const PP_PrintSettings_Dev*>(&settings));
174 }
175 } 172 }
176 173
177 void PPP_Printing_Proxy::OnPluginMsgPrintPages( 174 void PPP_Printing_Proxy::OnPluginMsgPrintPages(
178 PP_Instance instance, 175 PP_Instance instance,
179 const std::vector<PP_PrintPageNumberRange_Dev>& pages, 176 const std::vector<PP_PrintPageNumberRange_Dev>& pages,
180 HostResource* result) { 177 HostResource* result) {
181 if (!ppp_printing_impl_ || pages.empty()) 178 if (!ppp_printing_impl_ || pages.empty())
182 return; 179 return;
183 180
184 PP_Resource plugin_resource = CallWhileUnlocked( 181 PP_Resource plugin_resource = CallWhileUnlocked(
185 ppp_printing_impl_->PrintPages, 182 ppp_printing_impl_->PrintPages,
186 instance, &pages[0], static_cast<uint32_t>(pages.size())); 183 instance, &pages[0], pages.size());
187 ResourceTracker* resource_tracker = PpapiGlobals::Get()->GetResourceTracker(); 184 ResourceTracker* resource_tracker = PpapiGlobals::Get()->GetResourceTracker();
188 Resource* resource_object = resource_tracker->GetResource(plugin_resource); 185 Resource* resource_object = resource_tracker->GetResource(plugin_resource);
189 if (!resource_object) 186 if (!resource_object)
190 return; 187 return;
191 188
192 *result = resource_object->host_resource(); 189 *result = resource_object->host_resource();
193 190
194 // See PrintPages above for how refcounting works. 191 // See PrintPages above for how refcounting works.
195 resource_tracker->ReleaseResourceSoon(plugin_resource); 192 resource_tracker->ReleaseResourceSoon(plugin_resource);
196 } 193 }
197 194
198 void PPP_Printing_Proxy::OnPluginMsgEnd(PP_Instance instance) { 195 void PPP_Printing_Proxy::OnPluginMsgEnd(PP_Instance instance) {
199 if (ppp_printing_impl_) 196 if (ppp_printing_impl_)
200 CallWhileUnlocked(ppp_printing_impl_->End, instance); 197 CallWhileUnlocked(ppp_printing_impl_->End, instance);
201 } 198 }
202 199
203 void PPP_Printing_Proxy::OnPluginMsgIsScalingDisabled(PP_Instance instance, 200 void PPP_Printing_Proxy::OnPluginMsgIsScalingDisabled(PP_Instance instance,
204 bool* result) { 201 bool* result) {
205 if (ppp_printing_impl_) { 202 if (ppp_printing_impl_) {
206 *result = PP_ToBool(CallWhileUnlocked(ppp_printing_impl_->IsScalingDisabled, 203 *result = PP_ToBool(CallWhileUnlocked(ppp_printing_impl_->IsScalingDisabled,
207 instance)); 204 instance));
208 } else { 205 } else {
209 *result = false; 206 *result = false;
210 } 207 }
211 } 208 }
212 209
213 } // namespace proxy 210 } // namespace proxy
214 } // namespace ppapi 211 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppp_content_decryptor_private_proxy.cc ('k') | ppapi/proxy/video_capture_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698