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

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: Moved base/id_type... into gpu/command_buffer/common/id_type.… 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 binding_->set_connection_error_handler([this]() { OnConnectionError(); }); 153 binding_->set_connection_error_handler([this]() { OnConnectionError(); });
154 } 154 }
155 155
156 void CommandBufferImpl::InitializeOnGpuThread( 156 void CommandBufferImpl::InitializeOnGpuThread(
157 mojom::CommandBufferLostContextObserverPtr loss_observer, 157 mojom::CommandBufferLostContextObserverPtr loss_observer,
158 mojo::ScopedSharedBufferHandle shared_state, 158 mojo::ScopedSharedBufferHandle shared_state,
159 mojo::Array<int32_t> attribs, 159 mojo::Array<int32_t> attribs,
160 const base::Callback<void(mojom::CommandBufferInfoPtr)>& callback) { 160 const base::Callback<void(mojom::CommandBufferInfoPtr)>& callback) {
161 DCHECK(!driver_); 161 DCHECK(!driver_);
162 driver_.reset(new CommandBufferDriver( 162 driver_.reset(new CommandBufferDriver(
163 gpu::CommandBufferNamespace::MOJO, ++g_next_command_buffer_id, 163 gpu::CommandBufferNamespace::MOJO,
164 gpu::CommandBufferId::FromUnsafeValue(++g_next_command_buffer_id),
164 gfx::kNullAcceleratedWidget, gpu_state_)); 165 gfx::kNullAcceleratedWidget, gpu_state_));
165 driver_->set_client(make_scoped_ptr(new CommandBufferDriverClientImpl(this))); 166 driver_->set_client(make_scoped_ptr(new CommandBufferDriverClientImpl(this)));
166 loss_observer_ = mojo::MakeProxy(loss_observer.PassInterface()); 167 loss_observer_ = mojo::MakeProxy(loss_observer.PassInterface());
167 bool result = 168 bool result =
168 driver_->Initialize(std::move(shared_state), std::move(attribs)); 169 driver_->Initialize(std::move(shared_state), std::move(attribs));
169 mojom::CommandBufferInfoPtr info; 170 mojom::CommandBufferInfoPtr info;
170 if (result) { 171 if (result) {
171 info = mojom::CommandBufferInfo::New(); 172 info = mojom::CommandBufferInfo::New();
172 info->command_buffer_namespace = driver_->GetNamespaceID(); 173 info->command_buffer_namespace = driver_->GetNamespaceID();
173 info->command_buffer_id = driver_->GetCommandBufferID(); 174 info->command_buffer_id = driver_->GetCommandBufferID().GetUnsafeValue();
174 info->capabilities = 175 info->capabilities =
175 mojom::GpuCapabilities::From(driver_->GetCapabilities()); 176 mojom::GpuCapabilities::From(driver_->GetCapabilities());
176 } 177 }
177 gpu_state_->control_task_runner()->PostTask( 178 gpu_state_->control_task_runner()->PostTask(
178 FROM_HERE, base::Bind(callback, base::Passed(&info))); 179 FROM_HERE, base::Bind(callback, base::Passed(&info)));
179 } 180 }
180 181
181 bool CommandBufferImpl::SetGetBufferOnGpuThread(int32_t buffer) { 182 bool CommandBufferImpl::SetGetBufferOnGpuThread(int32_t buffer) {
182 DCHECK(driver_->IsScheduled()); 183 DCHECK(driver_->IsScheduled());
183 driver_->SetGetBuffer(buffer); 184 driver_->SetGetBuffer(buffer);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 driver_.get(), base::Bind(&CommandBufferImpl::DeleteOnGpuThread, 256 driver_.get(), base::Bind(&CommandBufferImpl::DeleteOnGpuThread,
256 base::Unretained(this))); 257 base::Unretained(this)));
257 } 258 }
258 259
259 bool CommandBufferImpl::DeleteOnGpuThread() { 260 bool CommandBufferImpl::DeleteOnGpuThread() {
260 delete this; 261 delete this;
261 return true; 262 return true;
262 } 263 }
263 264
264 } // namespace mus 265 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698