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

Side by Side Diff: ppapi/proxy/ppapi_command_buffer_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
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/ppapi_command_buffer_proxy.h" 5 #include "ppapi/proxy/ppapi_command_buffer_proxy.h"
6 6
7 #include "base/numerics/safe_conversions.h"
7 #include "ppapi/proxy/ppapi_messages.h" 8 #include "ppapi/proxy/ppapi_messages.h"
8 #include "ppapi/proxy/proxy_channel.h" 9 #include "ppapi/proxy/proxy_channel.h"
9 #include "ppapi/shared_impl/api_id.h" 10 #include "ppapi/shared_impl/api_id.h"
10 #include "ppapi/shared_impl/host_resource.h" 11 #include "ppapi/shared_impl/host_resource.h"
11 #include "ppapi/shared_impl/proxy_lock.h" 12 #include "ppapi/shared_impl/proxy_lock.h"
12 13
13 namespace ppapi { 14 namespace ppapi {
14 namespace proxy { 15 namespace proxy {
15 16
16 PpapiCommandBufferProxy::PpapiCommandBufferProxy( 17 PpapiCommandBufferProxy::PpapiCommandBufferProxy(
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 *id = -1; 116 *id = -1;
116 117
117 if (last_state_.error != gpu::error::kNoError) 118 if (last_state_.error != gpu::error::kNoError)
118 return NULL; 119 return NULL;
119 120
120 // Assuming we are in the renderer process, the service is responsible for 121 // Assuming we are in the renderer process, the service is responsible for
121 // duplicating the handle. This might not be true for NaCl. 122 // duplicating the handle. This might not be true for NaCl.
122 ppapi::proxy::SerializedHandle handle( 123 ppapi::proxy::SerializedHandle handle(
123 ppapi::proxy::SerializedHandle::SHARED_MEMORY); 124 ppapi::proxy::SerializedHandle::SHARED_MEMORY);
124 if (!Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer( 125 if (!Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer(
125 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, size, id, &handle))) { 126 ppapi::API_ID_PPB_GRAPHICS_3D, resource_,
127 base::checked_cast<uint32_t>(size), id, &handle))) {
126 return NULL; 128 return NULL;
127 } 129 }
128 130
129 if (*id <= 0 || !handle.is_shmem()) 131 if (*id <= 0 || !handle.is_shmem())
130 return NULL; 132 return NULL;
131 133
132 scoped_ptr<base::SharedMemory> shared_memory( 134 scoped_ptr<base::SharedMemory> shared_memory(
133 new base::SharedMemory(handle.shmem(), false)); 135 new base::SharedMemory(handle.shmem(), false));
134 136
135 // Map the shared memory on demand. 137 // Map the shared memory on demand.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 shared_state()->Read(&last_state_); 256 shared_state()->Read(&last_state_);
255 } 257 }
256 258
257 gpu::CommandBufferSharedState* PpapiCommandBufferProxy::shared_state() const { 259 gpu::CommandBufferSharedState* PpapiCommandBufferProxy::shared_state() const {
258 return reinterpret_cast<gpu::CommandBufferSharedState*>( 260 return reinterpret_cast<gpu::CommandBufferSharedState*>(
259 shared_state_shm_->memory()); 261 shared_state_shm_->memory());
260 } 262 }
261 263
262 } // namespace proxy 264 } // namespace proxy
263 } // namespace ppapi 265 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/platform_verification_private_resource.cc ('k') | ppapi/proxy/ppb_graphics_3d_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698