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

Side by Side Diff: components/mus/gles2/command_buffer_impl.cc

Issue 1548443002: Introducing gpu::CommandBufferId as a distinct, IdType<...>-based type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@type-safe-save-package-id-self-contained
Patch Set: Rebasing... Created 4 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 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 "components/mus/gles2/command_buffer_impl.h" 5 #include "components/mus/gles2/command_buffer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "components/mus/gles2/command_buffer_driver.h" 10 #include "components/mus/gles2/command_buffer_driver.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 183
184 void CommandBufferImpl::InitializeOnGpuThread( 184 void CommandBufferImpl::InitializeOnGpuThread(
185 mojom::CommandBufferClientPtr client, 185 mojom::CommandBufferClientPtr client,
186 mojo::ScopedSharedBufferHandle shared_state, 186 mojo::ScopedSharedBufferHandle shared_state,
187 mojo::Array<int32_t> attribs, 187 mojo::Array<int32_t> attribs,
188 const base::Callback< 188 const base::Callback<
189 void(mojom::CommandBufferInitializeResultPtr)>& callback) { 189 void(mojom::CommandBufferInitializeResultPtr)>& callback) {
190 DCHECK(!driver_); 190 DCHECK(!driver_);
191 driver_.reset(new CommandBufferDriver( 191 driver_.reset(new CommandBufferDriver(
192 gpu::CommandBufferNamespace::MOJO, ++g_next_command_buffer_id, 192 gpu::CommandBufferNamespace::MOJO,
193 gpu::CommandBufferId::FromUnsafeValue(++g_next_command_buffer_id),
193 gfx::kNullAcceleratedWidget, gpu_state_)); 194 gfx::kNullAcceleratedWidget, gpu_state_));
194 driver_->set_client(make_scoped_ptr(new CommandBufferDriverClientImpl(this))); 195 driver_->set_client(make_scoped_ptr(new CommandBufferDriverClientImpl(this)));
195 client_ = mojo::MakeProxy(client.PassInterface()); 196 client_ = mojo::MakeProxy(client.PassInterface());
196 bool result = 197 bool result =
197 driver_->Initialize(std::move(shared_state), std::move(attribs)); 198 driver_->Initialize(std::move(shared_state), std::move(attribs));
198 mojom::CommandBufferInitializeResultPtr initialize_result; 199 mojom::CommandBufferInitializeResultPtr initialize_result;
199 if (result) { 200 if (result) {
200 initialize_result = mojom::CommandBufferInitializeResult::New(); 201 initialize_result = mojom::CommandBufferInitializeResult::New();
201 initialize_result->command_buffer_namespace = driver_->GetNamespaceID(); 202 initialize_result->command_buffer_namespace = driver_->GetNamespaceID();
202 initialize_result->command_buffer_id = driver_->GetCommandBufferID(); 203 initialize_result->command_buffer_id =
204 driver_->GetCommandBufferID().GetUnsafeValue();
203 initialize_result->capabilities = driver_->GetCapabilities(); 205 initialize_result->capabilities = driver_->GetCapabilities();
204 } 206 }
205 gpu_state_->control_task_runner()->PostTask( 207 gpu_state_->control_task_runner()->PostTask(
206 FROM_HERE, base::Bind(callback, base::Passed(&initialize_result))); 208 FROM_HERE, base::Bind(callback, base::Passed(&initialize_result)));
207 } 209 }
208 210
209 bool CommandBufferImpl::SetGetBufferOnGpuThread(int32_t buffer) { 211 bool CommandBufferImpl::SetGetBufferOnGpuThread(int32_t buffer) {
210 DCHECK(driver_->IsScheduled()); 212 DCHECK(driver_->IsScheduled());
211 driver_->SetGetBuffer(buffer); 213 driver_->SetGetBuffer(buffer);
212 return true; 214 return true;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 driver_.get(), base::Bind(&CommandBufferImpl::DeleteOnGpuThread, 285 driver_.get(), base::Bind(&CommandBufferImpl::DeleteOnGpuThread,
284 base::Unretained(this))); 286 base::Unretained(this)));
285 } 287 }
286 288
287 bool CommandBufferImpl::DeleteOnGpuThread() { 289 bool CommandBufferImpl::DeleteOnGpuThread() {
288 delete this; 290 delete this;
289 return true; 291 return true;
290 } 292 }
291 293
292 } // namespace mus 294 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/gles2/command_buffer_driver.cc ('k') | components/mus/gles2/command_buffer_local.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698