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

Side by Side Diff: components/mus/gles2/command_buffer_local.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
« no previous file with comments | « components/mus/gles2/command_buffer_local.h ('k') | content/browser/download/save_types.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_local.h" 5 #include "components/mus/gles2/command_buffer_local.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 void CommandBufferLocal::EnsureWorkVisible() { 317 void CommandBufferLocal::EnsureWorkVisible() {
318 // This is only relevant for out-of-process command buffers. 318 // This is only relevant for out-of-process command buffers.
319 } 319 }
320 320
321 gpu::CommandBufferNamespace CommandBufferLocal::GetNamespaceID() const { 321 gpu::CommandBufferNamespace CommandBufferLocal::GetNamespaceID() const {
322 DCHECK(CalledOnValidThread()); 322 DCHECK(CalledOnValidThread());
323 return gpu::CommandBufferNamespace::MOJO_LOCAL; 323 return gpu::CommandBufferNamespace::MOJO_LOCAL;
324 } 324 }
325 325
326 uint64_t CommandBufferLocal::GetCommandBufferID() const { 326 gpu::CommandBufferId CommandBufferLocal::GetCommandBufferID() const {
327 DCHECK(CalledOnValidThread()); 327 DCHECK(CalledOnValidThread());
328 return driver_->GetCommandBufferID(); 328 return driver_->GetCommandBufferID();
329 } 329 }
330 330
331 int32_t CommandBufferLocal::GetExtraCommandBufferData() const { 331 int32_t CommandBufferLocal::GetExtraCommandBufferData() const {
332 DCHECK(CalledOnValidThread()); 332 DCHECK(CalledOnValidThread());
333 return 0; 333 return 0;
334 } 334 }
335 335
336 uint64_t CommandBufferLocal::GenerateFenceSyncRelease() { 336 uint64_t CommandBufferLocal::GenerateFenceSyncRelease() {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 base::Bind(&CommandBufferLocal::MakeProgressOnGpuThread, 414 base::Bind(&CommandBufferLocal::MakeProgressOnGpuThread,
415 base::Unretained(this), base::Unretained(&event), 415 base::Unretained(this), base::Unretained(&event),
416 base::Unretained(&state))); 416 base::Unretained(&state)));
417 event.Wait(); 417 event.Wait();
418 if (state.generation - last_state_.generation < 0x80000000U) 418 if (state.generation - last_state_.generation < 0x80000000U)
419 last_state_ = state; 419 last_state_ = state;
420 } 420 }
421 421
422 void CommandBufferLocal::InitializeOnGpuThread(base::WaitableEvent* event, 422 void CommandBufferLocal::InitializeOnGpuThread(base::WaitableEvent* event,
423 bool* result) { 423 bool* result) {
424 driver_.reset(new CommandBufferDriver(gpu::CommandBufferNamespace::MOJO_LOCAL, 424 driver_.reset(new CommandBufferDriver(
425 ++g_next_command_buffer_id, widget_, 425 gpu::CommandBufferNamespace::MOJO_LOCAL,
426 gpu_state_)); 426 gpu::CommandBufferId::FromUnsafeValue(++g_next_command_buffer_id),
427 widget_, gpu_state_));
427 const size_t kSharedStateSize = sizeof(gpu::CommandBufferSharedState); 428 const size_t kSharedStateSize = sizeof(gpu::CommandBufferSharedState);
428 void* memory = nullptr; 429 void* memory = nullptr;
429 mojo::ScopedSharedBufferHandle duped; 430 mojo::ScopedSharedBufferHandle duped;
430 *result = CreateMapAndDupSharedBuffer(kSharedStateSize, &memory, 431 *result = CreateMapAndDupSharedBuffer(kSharedStateSize, &memory,
431 &shared_state_handle_, &duped); 432 &shared_state_handle_, &duped);
432 433
433 if (!*result) { 434 if (!*result) {
434 event->Signal(); 435 event->Signal();
435 return; 436 return;
436 } 437 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 client_->DidLoseContext(); 526 client_->DidLoseContext();
526 } 527 }
527 528
528 void CommandBufferLocal::UpdateVSyncParametersOnClientThread(int64_t timebase, 529 void CommandBufferLocal::UpdateVSyncParametersOnClientThread(int64_t timebase,
529 int64_t interval) { 530 int64_t interval) {
530 if (client_) 531 if (client_)
531 client_->UpdateVSyncParameters(timebase, interval); 532 client_->UpdateVSyncParameters(timebase, interval);
532 } 533 }
533 534
534 } // namespace mus 535 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/gles2/command_buffer_local.h ('k') | content/browser/download/save_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698