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

Side by Side Diff: mojo/gles2/command_buffer_client_impl.cc

Issue 215803002: Remove CommandBuffer::GetTransferBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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/gles2/command_buffer_client_impl.h ('k') | mojo/mojo_examples.gypi » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/gles2/command_buffer_client_impl.h" 5 #include "mojo/gles2/command_buffer_client_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 MakeProgressAndUpdateState(); 96 MakeProgressAndUpdateState();
97 TryUpdateState(); 97 TryUpdateState();
98 } 98 }
99 } 99 }
100 100
101 void CommandBufferClientImpl::SetGetBuffer(int32 shm_id) { 101 void CommandBufferClientImpl::SetGetBuffer(int32 shm_id) {
102 command_buffer_->SetGetBuffer(shm_id); 102 command_buffer_->SetGetBuffer(shm_id);
103 last_put_offset_ = -1; 103 last_put_offset_ = -1;
104 } 104 }
105 105
106 void CommandBufferClientImpl::SetGetOffset(int32 get_offset) {
107 // Not implemented in proxy.
108 NOTREACHED();
109 }
110
111 scoped_refptr<gpu::Buffer> CommandBufferClientImpl::CreateTransferBuffer( 106 scoped_refptr<gpu::Buffer> CommandBufferClientImpl::CreateTransferBuffer(
112 size_t size, 107 size_t size,
113 int32* id) { 108 int32* id) {
114 if (size >= std::numeric_limits<uint32_t>::max()) 109 if (size >= std::numeric_limits<uint32_t>::max())
115 return NULL; 110 return NULL;
116 111
117 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory); 112 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory);
118 if (!shared_memory->CreateAndMapAnonymous(size)) 113 if (!shared_memory->CreateAndMapAnonymous(size))
119 return NULL; 114 return NULL;
120 115
121 base::SharedMemoryHandle handle; 116 base::SharedMemoryHandle handle;
122 shared_memory->ShareToProcess(base::GetCurrentProcessHandle(), &handle); 117 shared_memory->ShareToProcess(base::GetCurrentProcessHandle(), &handle);
123 if (!base::SharedMemory::IsHandleValid(handle)) 118 if (!base::SharedMemory::IsHandleValid(handle))
124 return NULL; 119 return NULL;
125 120
126 *id = ++next_transfer_buffer_id_; 121 *id = ++next_transfer_buffer_id_;
127 DCHECK(transfer_buffers_.find(*id) == transfer_buffers_.end());
128 122
129 AllocationScope scope; 123 AllocationScope scope;
130 command_buffer_->RegisterTransferBuffer( 124 command_buffer_->RegisterTransferBuffer(
131 *id, handle, static_cast<uint32_t>(size)); 125 *id, handle, static_cast<uint32_t>(size));
132 126
133 scoped_refptr<gpu::Buffer> buffer = 127 scoped_refptr<gpu::Buffer> buffer =
134 new gpu::Buffer(shared_memory.Pass(), size); 128 new gpu::Buffer(shared_memory.Pass(), size);
135 transfer_buffers_[*id] = buffer;
136
137 return buffer; 129 return buffer;
138 } 130 }
139 131
140 void CommandBufferClientImpl::DestroyTransferBuffer(int32 id) { 132 void CommandBufferClientImpl::DestroyTransferBuffer(int32 id) {
141 TransferBufferMap::iterator it = transfer_buffers_.find(id);
142 if (it != transfer_buffers_.end())
143 transfer_buffers_.erase(it);
144 command_buffer_->DestroyTransferBuffer(id); 133 command_buffer_->DestroyTransferBuffer(id);
145 } 134 }
146 135
147 scoped_refptr<gpu::Buffer> CommandBufferClientImpl::GetTransferBuffer(
148 int32 id) {
149 TransferBufferMap::iterator it = transfer_buffers_.find(id);
150 if (it != transfer_buffers_.end()) {
151 return it->second;
152 } else {
153 return NULL;
154 }
155 }
156
157 void CommandBufferClientImpl::SetToken(int32 token) {
158 // Not implemented in proxy.
159 NOTREACHED();
160 }
161
162 void CommandBufferClientImpl::SetParseError(gpu::error::Error error) {
163 // Not implemented in proxy.
164 NOTREACHED();
165 }
166
167 void CommandBufferClientImpl::SetContextLostReason(
168 gpu::error::ContextLostReason reason) {
169 // Not implemented in proxy.
170 NOTREACHED();
171 }
172
173 gpu::Capabilities CommandBufferClientImpl::GetCapabilities() { 136 gpu::Capabilities CommandBufferClientImpl::GetCapabilities() {
174 // TODO(piman) 137 // TODO(piman)
175 NOTIMPLEMENTED(); 138 NOTIMPLEMENTED();
176 return gpu::Capabilities(); 139 return gpu::Capabilities();
177 } 140 }
178 141
179 gfx::GpuMemoryBuffer* CommandBufferClientImpl::CreateGpuMemoryBuffer( 142 gfx::GpuMemoryBuffer* CommandBufferClientImpl::CreateGpuMemoryBuffer(
180 size_t width, 143 size_t width,
181 size_t height, 144 size_t height,
182 unsigned internalformat, 145 unsigned internalformat,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 return; 237 return;
275 } 238 }
276 } 239 }
277 240
278 void CommandBufferClientImpl::DrawAnimationFrame() { 241 void CommandBufferClientImpl::DrawAnimationFrame() {
279 delegate_->DrawAnimationFrame(); 242 delegate_->DrawAnimationFrame();
280 } 243 }
281 244
282 } // namespace gles2 245 } // namespace gles2
283 } // namespace mojo 246 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/gles2/command_buffer_client_impl.h ('k') | mojo/mojo_examples.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698