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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc
diff --git a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..70ffcdf0e4762c4792bd80203acbf27ddf27f38c
--- /dev/null
+++ b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc
@@ -0,0 +1,63 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/html_viewer/web_graphics_context_3d_command_buffer_impl.h"
+
+#include "components/mus/public/interfaces/gpu.mojom.h"
+#include "mojo/application/public/cpp/application_impl.h"
+#include "mojo/cc/context_provider_mojo.h"
+#include "mojo/gles2/gles2_context.h"
+#include "mojo/gpu/mojo_gles2_impl_autogen.h"
+#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
+
+namespace html_viewer {
+
+WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
+ mojo::ApplicationImpl* app,
+ const GURL& active_url,
+ const blink::WebGraphicsContext3D::Attributes& attributes,
+ blink::WebGraphicsContext3D* share_context,
+ blink::WebGLInfo* gl_info) {
+ mojo::URLRequestPtr request(mojo::URLRequest::New());
+ request->url = mojo::String::From("mojo:mus");
+ mojo::GpuPtr gpu_service;
+ app->ConnectToService(request.Pass(), &gpu_service);
+
+ mojo::CommandBufferPtr cb;
+ gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb));
+ command_buffer_handle_ = cb.PassInterface().PassHandle();
+ CHECK(command_buffer_handle_.is_valid());
+ // TODO(penghuang): Support share context.
+ // TODO(penghuang): Fill gl_info and pass attribuites to GPU.
+ gles2_context_ = MojoGLES2CreateContext(
+ command_buffer_handle_.release().value(),
+ &ContextLostThunk,
+ this,
+ mojo::Environment::GetDefaultAsyncWaiter());
+ context_gl_.reset(new mojo::MojoGLES2Impl(gles2_context_));
+ setGLInterface(context_gl_.get());
+}
+
+WebGraphicsContext3DCommandBufferImpl::
+ ~WebGraphicsContext3DCommandBufferImpl() {
+}
+
+// static
+WebGraphicsContext3DCommandBufferImpl*
+WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
+ mojo::ApplicationImpl* app,
+ const GURL& active_url,
+ const blink::WebGraphicsContext3D::Attributes& attributes,
+ blink::WebGraphicsContext3D* share_context,
+ blink::WebGLInfo* gl_info) {
+ return new WebGraphicsContext3DCommandBufferImpl(
+ app, active_url, attributes, share_context, gl_info);
+}
+
+void WebGraphicsContext3DCommandBufferImpl::ContextLost() {
+ if (context_lost_callback_)
+ context_lost_callback_->onContextLost();
+}
+
+} // namespace html_viewer
« 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