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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::kThreadPriority_Background); |
94 #endif | 94 #endif |
95 } | 95 } |
96 virtual ~TransferThread() { | 96 virtual ~TransferThread() { |
97 Stop(); | 97 Stop(); |
98 } | 98 } |
99 | 99 |
100 virtual void Init() OVERRIDE { | 100 virtual void Init() override { |
101 gfx::GLShareGroup* share_group = NULL; | 101 gfx::GLShareGroup* share_group = NULL; |
102 surface_ = new gfx::PbufferGLSurfaceEGL(gfx::Size(1, 1)); | 102 surface_ = new gfx::PbufferGLSurfaceEGL(gfx::Size(1, 1)); |
103 surface_->Initialize(); | 103 surface_->Initialize(); |
104 context_ = gfx::GLContext::CreateGLContext( | 104 context_ = gfx::GLContext::CreateGLContext( |
105 share_group, surface_.get(), gfx::PreferDiscreteGpu); | 105 share_group, surface_.get(), gfx::PreferDiscreteGpu); |
106 bool is_current = context_->MakeCurrent(surface_.get()); | 106 bool is_current = context_->MakeCurrent(surface_.get()); |
107 DCHECK(is_current); | 107 DCHECK(is_current); |
108 } | 108 } |
109 | 109 |
110 virtual void CleanUp() OVERRIDE { | 110 virtual void CleanUp() override { |
111 surface_ = NULL; | 111 surface_ = NULL; |
112 context_->ReleaseCurrent(surface_.get()); | 112 context_->ReleaseCurrent(surface_.get()); |
113 context_ = NULL; | 113 context_ = NULL; |
114 } | 114 } |
115 | 115 |
116 private: | 116 private: |
117 scoped_refptr<gfx::GLContext> context_; | 117 scoped_refptr<gfx::GLContext> context_; |
118 scoped_refptr<gfx::GLSurface> surface_; | 118 scoped_refptr<gfx::GLSurface> surface_; |
119 | 119 |
120 DISALLOW_COPY_AND_ASSIGN(TransferThread); | 120 DISALLOW_COPY_AND_ASSIGN(TransferThread); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 GLuint texture_id, | 402 GLuint texture_id, |
403 const AsyncTexImage2DParams& define_params); | 403 const AsyncTexImage2DParams& define_params); |
404 virtual ~AsyncPixelTransferDelegateEGL(); | 404 virtual ~AsyncPixelTransferDelegateEGL(); |
405 | 405 |
406 void BindTransfer() { state_->BindTransfer(); } | 406 void BindTransfer() { state_->BindTransfer(); } |
407 | 407 |
408 // Implement AsyncPixelTransferDelegate: | 408 // Implement AsyncPixelTransferDelegate: |
409 virtual void AsyncTexImage2D( | 409 virtual void AsyncTexImage2D( |
410 const AsyncTexImage2DParams& tex_params, | 410 const AsyncTexImage2DParams& tex_params, |
411 const AsyncMemoryParams& mem_params, | 411 const AsyncMemoryParams& mem_params, |
412 const base::Closure& bind_callback) OVERRIDE; | 412 const base::Closure& bind_callback) override; |
413 virtual void AsyncTexSubImage2D( | 413 virtual void AsyncTexSubImage2D( |
414 const AsyncTexSubImage2DParams& tex_params, | 414 const AsyncTexSubImage2DParams& tex_params, |
415 const AsyncMemoryParams& mem_params) OVERRIDE; | 415 const AsyncMemoryParams& mem_params) override; |
416 virtual bool TransferIsInProgress() OVERRIDE; | 416 virtual bool TransferIsInProgress() override; |
417 virtual void WaitForTransferCompletion() OVERRIDE; | 417 virtual void WaitForTransferCompletion() override; |
418 | 418 |
419 private: | 419 private: |
420 // Returns true if a work-around was used. | 420 // Returns true if a work-around was used. |
421 bool WorkAroundAsyncTexImage2D( | 421 bool WorkAroundAsyncTexImage2D( |
422 const AsyncTexImage2DParams& tex_params, | 422 const AsyncTexImage2DParams& tex_params, |
423 const AsyncMemoryParams& mem_params, | 423 const AsyncMemoryParams& mem_params, |
424 const base::Closure& bind_callback); | 424 const base::Closure& bind_callback); |
425 bool WorkAroundAsyncTexSubImage2D( | 425 bool WorkAroundAsyncTexSubImage2D( |
426 const AsyncTexSubImage2DParams& tex_params, | 426 const AsyncTexSubImage2DParams& tex_params, |
427 const AsyncMemoryParams& mem_params); | 427 const AsyncMemoryParams& mem_params); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 743 |
744 AsyncPixelTransferDelegate* | 744 AsyncPixelTransferDelegate* |
745 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( | 745 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( |
746 gles2::TextureRef* ref, | 746 gles2::TextureRef* ref, |
747 const AsyncTexImage2DParams& define_params) { | 747 const AsyncTexImage2DParams& define_params) { |
748 return new AsyncPixelTransferDelegateEGL( | 748 return new AsyncPixelTransferDelegateEGL( |
749 &shared_state_, ref->service_id(), define_params); | 749 &shared_state_, ref->service_id(), define_params); |
750 } | 750 } |
751 | 751 |
752 } // namespace gpu | 752 } // namespace gpu |
OLD | NEW |