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

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

Issue 915403003: Enable size_t to int truncation warnings in PPAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ppapi_unittests win x64 Created 5 years, 10 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
« no previous file with comments | « ppapi/proxy/ppp_instance_proxy_unittest.cc ('k') | ppapi/proxy/raw_var_data_unittest.cc » ('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 "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 "base/numerics/safe_conversions.h"
9 #include "ppapi/c/dev/ppp_printing_dev.h" 10 #include "ppapi/c/dev/ppp_printing_dev.h"
10 #include "ppapi/proxy/host_dispatcher.h" 11 #include "ppapi/proxy/host_dispatcher.h"
11 #include "ppapi/proxy/plugin_dispatcher.h" 12 #include "ppapi/proxy/plugin_dispatcher.h"
12 #include "ppapi/proxy/ppapi_messages.h" 13 #include "ppapi/proxy/ppapi_messages.h"
13 #include "ppapi/shared_impl/ppapi_globals.h" 14 #include "ppapi/shared_impl/ppapi_globals.h"
14 #include "ppapi/shared_impl/proxy_lock.h" 15 #include "ppapi/shared_impl/proxy_lock.h"
15 #include "ppapi/shared_impl/resource_tracker.h" 16 #include "ppapi/shared_impl/resource_tracker.h"
16 17
17 namespace ppapi { 18 namespace ppapi {
18 namespace proxy { 19 namespace proxy {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 174
174 void PPP_Printing_Proxy::OnPluginMsgPrintPages( 175 void PPP_Printing_Proxy::OnPluginMsgPrintPages(
175 PP_Instance instance, 176 PP_Instance instance,
176 const std::vector<PP_PrintPageNumberRange_Dev>& pages, 177 const std::vector<PP_PrintPageNumberRange_Dev>& pages,
177 HostResource* result) { 178 HostResource* result) {
178 if (!ppp_printing_impl_ || pages.empty()) 179 if (!ppp_printing_impl_ || pages.empty())
179 return; 180 return;
180 181
181 PP_Resource plugin_resource = CallWhileUnlocked( 182 PP_Resource plugin_resource = CallWhileUnlocked(
182 ppp_printing_impl_->PrintPages, 183 ppp_printing_impl_->PrintPages,
183 instance, &pages[0], pages.size()); 184 instance, &pages[0], base::checked_cast<uint32_t>(pages.size()));
184 ResourceTracker* resource_tracker = PpapiGlobals::Get()->GetResourceTracker(); 185 ResourceTracker* resource_tracker = PpapiGlobals::Get()->GetResourceTracker();
185 Resource* resource_object = resource_tracker->GetResource(plugin_resource); 186 Resource* resource_object = resource_tracker->GetResource(plugin_resource);
186 if (!resource_object) 187 if (!resource_object)
187 return; 188 return;
188 189
189 *result = resource_object->host_resource(); 190 *result = resource_object->host_resource();
190 191
191 // See PrintPages above for how refcounting works. 192 // See PrintPages above for how refcounting works.
192 resource_tracker->ReleaseResourceSoon(plugin_resource); 193 resource_tracker->ReleaseResourceSoon(plugin_resource);
193 } 194 }
194 195
195 void PPP_Printing_Proxy::OnPluginMsgEnd(PP_Instance instance) { 196 void PPP_Printing_Proxy::OnPluginMsgEnd(PP_Instance instance) {
196 if (ppp_printing_impl_) 197 if (ppp_printing_impl_)
197 CallWhileUnlocked(ppp_printing_impl_->End, instance); 198 CallWhileUnlocked(ppp_printing_impl_->End, instance);
198 } 199 }
199 200
200 void PPP_Printing_Proxy::OnPluginMsgIsScalingDisabled(PP_Instance instance, 201 void PPP_Printing_Proxy::OnPluginMsgIsScalingDisabled(PP_Instance instance,
201 bool* result) { 202 bool* result) {
202 if (ppp_printing_impl_) { 203 if (ppp_printing_impl_) {
203 *result = PP_ToBool(CallWhileUnlocked(ppp_printing_impl_->IsScalingDisabled, 204 *result = PP_ToBool(CallWhileUnlocked(ppp_printing_impl_->IsScalingDisabled,
204 instance)); 205 instance));
205 } else { 206 } else {
206 *result = false; 207 *result = false;
207 } 208 }
208 } 209 }
209 210
210 } // namespace proxy 211 } // namespace proxy
211 } // namespace ppapi 212 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppp_instance_proxy_unittest.cc ('k') | ppapi/proxy/raw_var_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698