OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 scoped_refptr<AsyncPixelTransferCompletionObserver> observer) { | 83 scoped_refptr<AsyncPixelTransferCompletionObserver> observer) { |
84 TRACE_EVENT0("gpu", "PerformNotifyCompletion"); | 84 TRACE_EVENT0("gpu", "PerformNotifyCompletion"); |
85 observer->DidComplete(mem_params); | 85 observer->DidComplete(mem_params); |
86 } | 86 } |
87 | 87 |
88 class TransferThread : public base::Thread { | 88 class TransferThread : public base::Thread { |
89 public: | 89 public: |
90 TransferThread() : base::Thread(kAsyncTransferThreadName) { | 90 TransferThread() : base::Thread(kAsyncTransferThreadName) { |
91 Start(); | 91 Start(); |
92 #if defined(OS_ANDROID) || defined(OS_LINUX) | 92 #if defined(OS_ANDROID) || defined(OS_LINUX) |
93 SetPriority(base::kThreadPriority_Background); | 93 SetPriority(base::ThreadPriority::BACKGROUND); |
94 #endif | 94 #endif |
95 } | 95 } |
96 ~TransferThread() override { Stop(); } | 96 ~TransferThread() override { Stop(); } |
97 | 97 |
98 void Init() override { | 98 void Init() override { |
99 gfx::GLShareGroup* share_group = NULL; | 99 gfx::GLShareGroup* share_group = NULL; |
100 surface_ = new gfx::PbufferGLSurfaceEGL(gfx::Size(1, 1)); | 100 surface_ = new gfx::PbufferGLSurfaceEGL(gfx::Size(1, 1)); |
101 surface_->Initialize(); | 101 surface_->Initialize(); |
102 context_ = gfx::GLContext::CreateGLContext( | 102 context_ = gfx::GLContext::CreateGLContext( |
103 share_group, surface_.get(), gfx::PreferDiscreteGpu); | 103 share_group, surface_.get(), gfx::PreferDiscreteGpu); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 459 |
460 AsyncPixelTransferDelegateEGL::~AsyncPixelTransferDelegateEGL() {} | 460 AsyncPixelTransferDelegateEGL::~AsyncPixelTransferDelegateEGL() {} |
461 | 461 |
462 bool AsyncPixelTransferDelegateEGL::TransferIsInProgress() { | 462 bool AsyncPixelTransferDelegateEGL::TransferIsInProgress() { |
463 return state_->TransferIsInProgress(); | 463 return state_->TransferIsInProgress(); |
464 } | 464 } |
465 | 465 |
466 void AsyncPixelTransferDelegateEGL::WaitForTransferCompletion() { | 466 void AsyncPixelTransferDelegateEGL::WaitForTransferCompletion() { |
467 if (state_->TransferIsInProgress()) { | 467 if (state_->TransferIsInProgress()) { |
468 #if defined(OS_ANDROID) || defined(OS_LINUX) | 468 #if defined(OS_ANDROID) || defined(OS_LINUX) |
469 g_transfer_thread.Pointer()->SetPriority(base::kThreadPriority_Display); | 469 g_transfer_thread.Pointer()->SetPriority(base::ThreadPriority::DISPLAY); |
470 #endif | 470 #endif |
471 | 471 |
472 state_->WaitForTransferCompletion(); | 472 state_->WaitForTransferCompletion(); |
473 DCHECK(!state_->TransferIsInProgress()); | 473 DCHECK(!state_->TransferIsInProgress()); |
474 | 474 |
475 #if defined(OS_ANDROID) || defined(OS_LINUX) | 475 #if defined(OS_ANDROID) || defined(OS_LINUX) |
476 g_transfer_thread.Pointer()->SetPriority(base::kThreadPriority_Background); | 476 g_transfer_thread.Pointer()->SetPriority(base::ThreadPriority::BACKGROUND); |
477 #endif | 477 #endif |
478 } | 478 } |
479 } | 479 } |
480 | 480 |
481 void AsyncPixelTransferDelegateEGL::AsyncTexImage2D( | 481 void AsyncPixelTransferDelegateEGL::AsyncTexImage2D( |
482 const AsyncTexImage2DParams& tex_params, | 482 const AsyncTexImage2DParams& tex_params, |
483 const AsyncMemoryParams& mem_params, | 483 const AsyncMemoryParams& mem_params, |
484 const base::Closure& bind_callback) { | 484 const base::Closure& bind_callback) { |
485 if (WorkAroundAsyncTexImage2D(tex_params, mem_params, bind_callback)) | 485 if (WorkAroundAsyncTexImage2D(tex_params, mem_params, bind_callback)) |
486 return; | 486 return; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 | 737 |
738 AsyncPixelTransferDelegate* | 738 AsyncPixelTransferDelegate* |
739 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( | 739 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( |
740 gles2::TextureRef* ref, | 740 gles2::TextureRef* ref, |
741 const AsyncTexImage2DParams& define_params) { | 741 const AsyncTexImage2DParams& define_params) { |
742 return new AsyncPixelTransferDelegateEGL( | 742 return new AsyncPixelTransferDelegateEGL( |
743 &shared_state_, ref->service_id(), define_params); | 743 &shared_state_, ref->service_id(), define_params); |
744 } | 744 } |
745 | 745 |
746 } // namespace gpu | 746 } // namespace gpu |
OLD | NEW |