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

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

Issue 1338433002: Mandoline: Add WebGL support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gn check issue Created 5 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/html_viewer/web_graphics_context_3d_command_buffer_impl.h"
6
7 #include "components/mus/public/interfaces/gpu.mojom.h"
8 #include "mojo/application/public/cpp/application_impl.h"
9 #include "mojo/cc/context_provider_mojo.h"
10 #include "mojo/gles2/gles2_context.h"
11 #include "mojo/gpu/mojo_gles2_impl_autogen.h"
12 #include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
13
14 namespace html_viewer {
15
16 WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
17 mojo::ApplicationImpl* app,
18 const GURL& active_url,
19 const blink::WebGraphicsContext3D::Attributes& attributes,
20 blink::WebGraphicsContext3D* share_context,
21 blink::WebGLInfo* gl_info) {
22 mojo::URLRequestPtr request(mojo::URLRequest::New());
23 request->url = mojo::String::From("mojo:mus");
24 mojo::GpuPtr gpu_service;
25 app->ConnectToService(request.Pass(), &gpu_service);
26
27 mojo::CommandBufferPtr cb;
28 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb));
29 command_buffer_handle_ = cb.PassInterface().PassHandle();
30 CHECK(command_buffer_handle_.is_valid());
31 // TODO(penghuang): Support share context.
32 // TODO(penghuang): Fill gl_info and pass attribuites to GPU.
33 gles2_context_ = MojoGLES2CreateContext(
34 command_buffer_handle_.release().value(),
35 &ContextLostThunk,
36 this,
37 mojo::Environment::GetDefaultAsyncWaiter());
38 context_gl_.reset(new mojo::MojoGLES2Impl(gles2_context_));
39 setGLInterface(context_gl_.get());
40 }
41
42 WebGraphicsContext3DCommandBufferImpl::
43 ~WebGraphicsContext3DCommandBufferImpl() {
44 }
45
46 // static
47 WebGraphicsContext3DCommandBufferImpl*
48 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
49 mojo::ApplicationImpl* app,
50 const GURL& active_url,
51 const blink::WebGraphicsContext3D::Attributes& attributes,
52 blink::WebGraphicsContext3D* share_context,
53 blink::WebGLInfo* gl_info) {
54 return new WebGraphicsContext3DCommandBufferImpl(
55 app, active_url, attributes, share_context, gl_info);
56 }
57
58 void WebGraphicsContext3DCommandBufferImpl::ContextLost() {
59 if (context_lost_callback_)
60 context_lost_callback_->onContextLost();
61 }
62
63 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/web_graphics_context_3d_command_buffer_impl.h ('k') | components/mus/gles2/command_buffer_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698