| 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 "components/mus/gles2/command_buffer_driver.h" | 5 #include "components/mus/gles2/command_buffer_driver.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 bool CommandBufferDriver::Initialize( | 80 bool CommandBufferDriver::Initialize( |
| 81 mojo::ScopedSharedBufferHandle shared_state, | 81 mojo::ScopedSharedBufferHandle shared_state, |
| 82 mojo::Array<int32_t> attribs) { | 82 mojo::Array<int32_t> attribs) { |
| 83 DCHECK(CalledOnValidThread()); | 83 DCHECK(CalledOnValidThread()); |
| 84 gpu::gles2::ContextCreationAttribHelper attrib_helper; | 84 gpu::gles2::ContextCreationAttribHelper attrib_helper; |
| 85 if (!attrib_helper.Parse(attribs.storage())) | 85 if (!attrib_helper.Parse(attribs.storage())) |
| 86 return false; | 86 return false; |
| 87 | 87 |
| 88 const bool offscreen = widget_ == gfx::kNullAcceleratedWidget; | 88 const bool offscreen = widget_ == gfx::kNullAcceleratedWidget; |
| 89 static scoped_refptr<gfx::GLSurface> underlying_surface; | |
| 90 if (offscreen) { | 89 if (offscreen) { |
| 91 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(0, 0)); | 90 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(0, 0)); |
| 92 } else { | 91 } else { |
| 93 #if defined(USE_OZONE) | 92 #if defined(USE_OZONE) |
| 94 scoped_refptr<gfx::GLSurface> underlying_surface = | 93 scoped_refptr<gfx::GLSurface> underlying_surface = |
| 95 gfx::GLSurface::CreateSurfacelessViewGLSurface(widget_); | 94 gfx::GLSurface::CreateSurfacelessViewGLSurface(widget_); |
| 96 if (!underlying_surface) | 95 if (!underlying_surface) |
| 97 underlying_surface = gfx::GLSurface::CreateViewGLSurface(widget_); | 96 underlying_surface = gfx::GLSurface::CreateViewGLSurface(widget_); |
| 98 #else | 97 #else |
| 99 scoped_refptr<gfx::GLSurface> underlying_surface = | 98 scoped_refptr<gfx::GLSurface> underlying_surface = |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 } | 543 } |
| 545 | 544 |
| 546 void CommandBufferDriver::OnGpuCompletedSwapBuffers(gfx::SwapResult result) { | 545 void CommandBufferDriver::OnGpuCompletedSwapBuffers(gfx::SwapResult result) { |
| 547 DCHECK(CalledOnValidThread()); | 546 DCHECK(CalledOnValidThread()); |
| 548 if (client_) { | 547 if (client_) { |
| 549 client_->OnGpuCompletedSwapBuffers(result); | 548 client_->OnGpuCompletedSwapBuffers(result); |
| 550 } | 549 } |
| 551 } | 550 } |
| 552 | 551 |
| 553 } // namespace mus | 552 } // namespace mus |
| OLD | NEW |