Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc

Issue 1384233003: Improve usefulness of webglcontextcreationerror statusMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 11 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
12 #include "mojo/application/public/cpp/application_impl.h" 12 #include "mojo/application/public/cpp/application_impl.h"
13 #include "mojo/gles2/gles2_context.h" 13 #include "mojo/gles2/gles2_context.h"
14 #include "mojo/gpu/mojo_gles2_impl_autogen.h" 14 #include "mojo/gpu/mojo_gles2_impl_autogen.h"
15 #include "third_party/mojo/src/mojo/public/cpp/environment/environment.h" 15 #include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
16 #include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h" 16 #include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
17 17
18 namespace html_viewer { 18 namespace html_viewer {
19 19
20 // static 20 // static
21 WebGraphicsContext3DCommandBufferImpl* 21 WebGraphicsContext3DCommandBufferImpl*
22 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 22 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
23 GlobalState* global_state, 23 GlobalState* global_state,
24 mojo::ApplicationImpl* app, 24 mojo::ApplicationImpl* app,
25 const GURL& active_url, 25 const GURL& active_url,
26 const blink::WebGraphicsContext3D::Attributes& attributes, 26 const blink::WebGraphicsContext3D::Attributes& attributes,
27 blink::WebGraphicsContext3D* share_context, 27 blink::WebGraphicsContext3D* share_context,
28 blink::WebGLInfo* gl_info) { 28 blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info) {
29 const mus::mojom::GpuInfo* gpu_info = global_state->GetGpuInfo(); 29 const mus::mojom::GpuInfo* gpu_info = global_state->GetGpuInfo();
30 gl_info->vendorId = gpu_info->vendor_id; 30 if (gl_info) {
31 gl_info->deviceId = gpu_info->device_id; 31 gl_info->vendorId = gpu_info->vendor_id;
32 gl_info->vendorInfo = gpu_info->vendor_info.To<blink::WebString>(); 32 gl_info->deviceId = gpu_info->device_id;
33 gl_info->rendererInfo = gpu_info->renderer_info.To<blink::WebString>(); 33 gl_info->vendorInfo = gpu_info->vendor_info.To<blink::WebString>();
34 gl_info->driverVersion = gpu_info->driver_version.To<blink::WebString>(); 34 gl_info->rendererInfo = gpu_info->renderer_info.To<blink::WebString>();
35 35 gl_info->driverVersion = gpu_info->driver_version.To<blink::WebString>();
36 }
36 mojo::URLRequestPtr request(mojo::URLRequest::New()); 37 mojo::URLRequestPtr request(mojo::URLRequest::New());
37 request->url = mojo::String::From("mojo:mus"); 38 request->url = mojo::String::From("mojo:mus");
38 mus::mojom::GpuPtr gpu_service; 39 mus::mojom::GpuPtr gpu_service;
39 app->ConnectToService(request.Pass(), &gpu_service); 40 app->ConnectToService(request.Pass(), &gpu_service);
40 mus::mojom::CommandBufferPtr cb; 41 mus::mojom::CommandBufferPtr cb;
41 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); 42 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb));
42 return new WebGraphicsContext3DCommandBufferImpl( 43 return new WebGraphicsContext3DCommandBufferImpl(
43 cb.PassInterface(), active_url, attributes, share_context); 44 cb.PassInterface(), active_url, attributes, share_context);
44 } 45 }
45 46
(...skipping 24 matching lines...) Expand all
70 if (gles2_context_) 71 if (gles2_context_)
71 MojoGLES2DestroyContext(gles2_context_); 72 MojoGLES2DestroyContext(gles2_context_);
72 } 73 }
73 74
74 void WebGraphicsContext3DCommandBufferImpl::ContextLost() { 75 void WebGraphicsContext3DCommandBufferImpl::ContextLost() {
75 if (context_lost_callback_) 76 if (context_lost_callback_)
76 context_lost_callback_->onContextLost(); 77 context_lost_callback_->onContextLost();
77 } 78 }
78 79
79 } // namespace html_viewer 80 } // namespace html_viewer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698