| 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/html_viewer/blink_basic_type_converters.h" | 7 #include "components/html_viewer/blink_basic_type_converters.h" |
| 8 #include "components/html_viewer/global_state.h" | 8 #include "components/html_viewer/global_state.h" |
| 9 #include "components/mus/public/cpp/context_provider.h" | 9 #include "components/mus/public/cpp/context_provider.h" |
| 10 #include "components/mus/public/interfaces/gpu.mojom.h" | 10 #include "components/mus/public/interfaces/gpu.mojom.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 blink::WebGraphicsContext3D* share_context, | 27 blink::WebGraphicsContext3D* share_context, |
| 28 blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info) { | 28 blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info) { |
| 29 DCHECK(gl_info); | 29 DCHECK(gl_info); |
| 30 const mus::mojom::GpuInfo* gpu_info = global_state->GetGpuInfo(); | 30 const mus::mojom::GpuInfo* gpu_info = global_state->GetGpuInfo(); |
| 31 gl_info->vendorId = gpu_info->vendor_id; | 31 gl_info->vendorId = gpu_info->vendor_id; |
| 32 gl_info->deviceId = gpu_info->device_id; | 32 gl_info->deviceId = gpu_info->device_id; |
| 33 gl_info->vendorInfo = gpu_info->vendor_info.To<blink::WebString>(); | 33 gl_info->vendorInfo = gpu_info->vendor_info.To<blink::WebString>(); |
| 34 gl_info->rendererInfo = gpu_info->renderer_info.To<blink::WebString>(); | 34 gl_info->rendererInfo = gpu_info->renderer_info.To<blink::WebString>(); |
| 35 gl_info->driverVersion = gpu_info->driver_version.To<blink::WebString>(); | 35 gl_info->driverVersion = gpu_info->driver_version.To<blink::WebString>(); |
| 36 | 36 |
| 37 mojo::URLRequestPtr request(mojo::URLRequest::New()); | |
| 38 request->url = mojo::String::From("mojo:mus"); | |
| 39 mus::mojom::GpuPtr gpu_service; | 37 mus::mojom::GpuPtr gpu_service; |
| 40 app->ConnectToService(request.Pass(), &gpu_service); | 38 app->ConnectToService("mojo:mus", &gpu_service); |
| 41 mus::mojom::CommandBufferPtr cb; | 39 mus::mojom::CommandBufferPtr cb; |
| 42 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); | 40 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); |
| 43 return new WebGraphicsContext3DCommandBufferImpl( | 41 return new WebGraphicsContext3DCommandBufferImpl( |
| 44 cb.PassInterface(), active_url, attributes, share_context); | 42 cb.PassInterface(), active_url, attributes, share_context); |
| 45 } | 43 } |
| 46 | 44 |
| 47 WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( | 45 WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( |
| 48 mojo::InterfacePtrInfo<mus::mojom::CommandBuffer> command_buffer_info, | 46 mojo::InterfacePtrInfo<mus::mojom::CommandBuffer> command_buffer_info, |
| 49 const GURL& active_url, | 47 const GURL& active_url, |
| 50 const blink::WebGraphicsContext3D::Attributes& attributes, | 48 const blink::WebGraphicsContext3D::Attributes& attributes, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 if (gles2_context_) | 69 if (gles2_context_) |
| 72 MojoGLES2DestroyContext(gles2_context_); | 70 MojoGLES2DestroyContext(gles2_context_); |
| 73 } | 71 } |
| 74 | 72 |
| 75 void WebGraphicsContext3DCommandBufferImpl::ContextLost() { | 73 void WebGraphicsContext3DCommandBufferImpl::ContextLost() { |
| 76 if (context_lost_callback_) | 74 if (context_lost_callback_) |
| 77 context_lost_callback_->onContextLost(); | 75 context_lost_callback_->onContextLost(); |
| 78 } | 76 } |
| 79 | 77 |
| 80 } // namespace html_viewer | 78 } // namespace html_viewer |
| OLD | NEW |