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

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

Issue 213353005: Refactor gpu::Buffer to allow different types of backing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix pointer alignment in tests Created 6 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 | « mojo/services/gles2/command_buffer_impl.cc ('k') | ppapi/proxy/ppb_graphics_3d_proxy.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/ppapi_command_buffer_proxy.h" 5 #include "ppapi/proxy/ppapi_command_buffer_proxy.h"
6 6
7 #include "ppapi/proxy/ppapi_messages.h" 7 #include "ppapi/proxy/ppapi_messages.h"
8 #include "ppapi/proxy/proxy_channel.h" 8 #include "ppapi/proxy/proxy_channel.h"
9 #include "ppapi/shared_impl/api_id.h" 9 #include "ppapi/shared_impl/api_id.h"
10 #include "ppapi/shared_impl/host_resource.h" 10 #include "ppapi/shared_impl/host_resource.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 scoped_ptr<base::SharedMemory> shared_memory( 129 scoped_ptr<base::SharedMemory> shared_memory(
130 new base::SharedMemory(handle.shmem(), false)); 130 new base::SharedMemory(handle.shmem(), false));
131 131
132 // Map the shared memory on demand. 132 // Map the shared memory on demand.
133 if (!shared_memory->memory()) { 133 if (!shared_memory->memory()) {
134 if (!shared_memory->Map(handle.size())) { 134 if (!shared_memory->Map(handle.size())) {
135 return NULL; 135 return NULL;
136 } 136 }
137 } 137 }
138 138
139 scoped_refptr<gpu::Buffer> buffer = 139 return gpu::MakeBufferFromSharedMemory(shared_memory.Pass(), handle.size());
140 new gpu::Buffer(shared_memory.Pass(), handle.size());
141 return buffer;
142 } 140 }
143 141
144 void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) { 142 void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) {
145 if (last_state_.error != gpu::error::kNoError) 143 if (last_state_.error != gpu::error::kNoError)
146 return; 144 return;
147 145
148 Send(new PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer( 146 Send(new PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer(
149 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id)); 147 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id));
150 } 148 }
151 149
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 last_state_ = state; 223 last_state_ = state;
226 } 224 }
227 } else { 225 } else {
228 last_state_.error = gpu::error::kLostContext; 226 last_state_.error = gpu::error::kLostContext;
229 ++last_state_.generation; 227 ++last_state_.generation;
230 } 228 }
231 } 229 }
232 230
233 } // namespace proxy 231 } // namespace proxy
234 } // namespace ppapi 232 } // namespace ppapi
OLDNEW
« no previous file with comments | « mojo/services/gles2/command_buffer_impl.cc ('k') | ppapi/proxy/ppb_graphics_3d_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698