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

Unified Diff: components/html_viewer/blink_platform_impl.cc

Issue 1338433002: Mandoline: Add WebGL support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add --enable-webgl switch 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
« no previous file with comments | « components/html_viewer/blink_platform_impl.h ('k') | components/html_viewer/html_widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/blink_platform_impl.cc
diff --git a/components/html_viewer/blink_platform_impl.cc b/components/html_viewer/blink_platform_impl.cc
index fbf40d3ab3ac60db81b7da6b4490111de0f11e08..981c1276a7d30b67b64af57ff926d99383c998d6 100644
--- a/components/html_viewer/blink_platform_impl.cc
+++ b/components/html_viewer/blink_platform_impl.cc
@@ -17,6 +17,7 @@
#include "components/html_viewer/blink_resource_constants.h"
#include "components/html_viewer/web_clipboard_impl.h"
#include "components/html_viewer/web_cookie_jar_impl.h"
+#include "components/html_viewer/web_graphics_context_3d_command_buffer_impl.h"
#include "components/html_viewer/web_socket_handle_impl.h"
#include "components/html_viewer/web_url_loader_impl.h"
#include "components/message_port/web_message_port_channel_impl.h"
@@ -34,12 +35,14 @@
#include "third_party/WebKit/public/platform/WebWaitableEvent.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/events/gestures/blink/web_gesture_curve_impl.h"
+#include "url/gurl.h"
namespace html_viewer {
namespace {
// Allows overriding user agent scring.
const char kUserAgentSwitch[] = "user-agent";
+const char kEnableWebGLSwitch[] = "enable-webgl";
class WebWaitableEventImpl : public blink::WebWaitableEvent {
public:
@@ -68,7 +71,8 @@ class WebWaitableEventImpl : public blink::WebWaitableEvent {
BlinkPlatformImpl::BlinkPlatformImpl(
mojo::ApplicationImpl* app,
scheduler::RendererScheduler* renderer_scheduler)
- : main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()),
+ : app_(app),
+ main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()),
main_thread_(new scheduler::WebThreadImplForRendererScheduler(
renderer_scheduler)) {
if (app) {
@@ -162,6 +166,38 @@ const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag(
return buf;
}
+blink::WebGraphicsContext3D*
+BlinkPlatformImpl::createOffscreenGraphicsContext3D(
+ const blink::WebGraphicsContext3D::Attributes& attributes,
+ blink::WebGraphicsContext3D* shareContext) {
+ return createOffscreenGraphicsContext3D(attributes, shareContext, nullptr);
+}
+
+blink::WebGraphicsContext3D*
+BlinkPlatformImpl::createOffscreenGraphicsContext3D(
+ const blink::WebGraphicsContext3D::Attributes& attributes,
+ blink::WebGraphicsContext3D* shareContext,
+ blink::WebGLInfo* glInfo) {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(kEnableWebGLSwitch)) {
Fady Samuel 2015/09/14 19:21:43 Why make this a switch?
Peng 2015/09/14 19:28:46 I tested it with some simple webgl pages, it works
+ return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
+ app_, GURL(attributes.topDocumentURL), attributes, shareContext,
+ glInfo);
+ }
+ return nullptr;
+}
+
+blink::WebGraphicsContext3D*
+BlinkPlatformImpl::createOffscreenGraphicsContext3D(
+ const blink::WebGraphicsContext3D::Attributes& attributes) {
+ return createOffscreenGraphicsContext3D(attributes, nullptr, nullptr);
+}
+
+blink::WebGraphicsContext3DProvider*
+BlinkPlatformImpl::createSharedOffscreenGraphicsContext3DProvider() {
+ return nullptr;
+}
+
blink::WebData BlinkPlatformImpl::loadResource(const char* resource) {
for (size_t i = 0; i < arraysize(kDataResources); ++i) {
if (!strcmp(resource, kDataResources[i].name)) {
« no previous file with comments | « components/html_viewer/blink_platform_impl.h ('k') | components/html_viewer/html_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698