| OLD | NEW |
| 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/html_viewer/web_graphics_context_3d_command_buffer_impl.h" | 5 #include "components/html_viewer/web_graphics_context_3d_command_buffer_impl.h" |
| 6 | 6 |
| 7 #include "components/mus/public/interfaces/gpu.mojom.h" | 7 #include "components/mus/public/interfaces/gpu.mojom.h" |
| 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 9 #include "mojo/application/public/cpp/application_impl.h" | 9 #include "mojo/application/public/cpp/application_impl.h" |
| 10 #include "mojo/cc/context_provider_mojo.h" | 10 #include "mojo/cc/context_provider_mojo.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 attrib_vector.data(), | 48 attrib_vector.data(), |
| 49 &ContextLostThunk, | 49 &ContextLostThunk, |
| 50 this, | 50 this, |
| 51 mojo::Environment::GetDefaultAsyncWaiter()); | 51 mojo::Environment::GetDefaultAsyncWaiter()); |
| 52 context_gl_.reset(new mojo::MojoGLES2Impl(gles2_context_)); | 52 context_gl_.reset(new mojo::MojoGLES2Impl(gles2_context_)); |
| 53 setGLInterface(context_gl_.get()); | 53 setGLInterface(context_gl_.get()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 WebGraphicsContext3DCommandBufferImpl:: | 56 WebGraphicsContext3DCommandBufferImpl:: |
| 57 ~WebGraphicsContext3DCommandBufferImpl() { | 57 ~WebGraphicsContext3DCommandBufferImpl() { |
| 58 if (gles2_context_) |
| 59 MojoGLES2DestroyContext(gles2_context_); |
| 58 } | 60 } |
| 59 | 61 |
| 60 // static | 62 // static |
| 61 WebGraphicsContext3DCommandBufferImpl* | 63 WebGraphicsContext3DCommandBufferImpl* |
| 62 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 64 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 63 mojo::ApplicationImpl* app, | 65 mojo::ApplicationImpl* app, |
| 64 const GURL& active_url, | 66 const GURL& active_url, |
| 65 const blink::WebGraphicsContext3D::Attributes& attributes, | 67 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 66 blink::WebGraphicsContext3D* share_context, | 68 blink::WebGraphicsContext3D* share_context, |
| 67 blink::WebGLInfo* gl_info) { | 69 blink::WebGLInfo* gl_info) { |
| 68 return new WebGraphicsContext3DCommandBufferImpl( | 70 return new WebGraphicsContext3DCommandBufferImpl( |
| 69 app, active_url, attributes, share_context, gl_info); | 71 app, active_url, attributes, share_context, gl_info); |
| 70 } | 72 } |
| 71 | 73 |
| 72 void WebGraphicsContext3DCommandBufferImpl::ContextLost() { | 74 void WebGraphicsContext3DCommandBufferImpl::ContextLost() { |
| 73 if (context_lost_callback_) | 75 if (context_lost_callback_) |
| 74 context_lost_callback_->onContextLost(); | 76 context_lost_callback_->onContextLost(); |
| 75 } | 77 } |
| 76 | 78 |
| 77 } // namespace html_viewer | 79 } // namespace html_viewer |
| OLD | NEW |