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

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: Rebase and address review issues 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 int surface_id,
18 mojo::ApplicationImpl* app,
19 const GURL& active_url,
20 const blink::WebGraphicsContext3D::Attributes& attributes,
21 blink::WebGraphicsContext3D* shareContext,
22 blink::WebGLInfo* glInfo)
23 : surface_id_(surface_id) {
24 mojo::URLRequestPtr request(mojo::URLRequest::New());
25 request->url = mojo::String::From("mojo:view_manager");
Fady Samuel 2015/09/16 00:15:39 mojo:mus now.
Peng 2015/09/16 13:54:59 Done.
26 mojo::GpuPtr gpu_service;
27 app->ConnectToService(request.Pass(), &gpu_service);
28
29 mojo::CommandBufferPtr cb;
30 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb));
31 command_buffer_handle_ = cb.PassInterface().PassHandle();
32 CHECK(command_buffer_handle_.is_valid());
33 // TODO(penghuang): Support share context.
34 // TODO(penghuang): Fill glInfo and pass attribuites to GPU.
35 gles2_context_ = MojoGLES2CreateContext(
36 command_buffer_handle_.release().value(),
37 &ContextLostThunk,
38 this,
39 mojo::Environment::GetDefaultAsyncWaiter());
40 context_gl_.reset(new mojo::MojoGLES2Impl(gles2_context_));
41 setGLInterface(context_gl_.get());
42 }
43
44 WebGraphicsContext3DCommandBufferImpl::
45 ~WebGraphicsContext3DCommandBufferImpl() {
46 }
47
48 // static
49 WebGraphicsContext3DCommandBufferImpl*
50 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
51 mojo::ApplicationImpl* app,
52 const GURL& active_url,
53 const blink::WebGraphicsContext3D::Attributes& attributes,
54 blink::WebGraphicsContext3D* shareContext,
55 blink::WebGLInfo* glInfo) {
56 if (!app)
sky 2015/09/15 22:10:58 Under what circumstances is app null?
Peng 2015/09/16 13:54:59 Done.
57 return nullptr;
58
59 return new WebGraphicsContext3DCommandBufferImpl(
60 0, app, active_url, attributes, shareContext, glInfo);
sky 2015/09/15 22:10:58 I don't see surface_id_ used. Is it needed?
Peng 2015/09/16 13:54:59 It is not useful right now. Removed.
61 }
62
63 void WebGraphicsContext3DCommandBufferImpl::ContextLost() {
64 if (context_lost_callback_)
65 context_lost_callback_->onContextLost();
66 }
67
68 } // namespace html_viewer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698