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

Unified Diff: content/renderer/render_view_impl.cc

Issue 10798006: Implement WebCompositorOutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 4 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 | « content/renderer/render_view_impl.h ('k') | ipc/ipc_forwarding_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 651946597a1f378f54141f152a2d0098af6de412..5884d036deec8f3f66240950f21e730a8ab75c0e 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -69,6 +69,7 @@
#include "content/renderer/external_popup_menu.h"
#include "content/renderer/geolocation_dispatcher.h"
#include "content/renderer/gpu/compositor_thread.h"
+#include "content/renderer/gpu/compositor_output_surface.h"
#include "content/renderer/idle_user_detector.h"
#include "content/renderer/input_tag_speech_dispatcher.h"
#include "content/renderer/java/java_bridge_dispatcher.h"
@@ -108,6 +109,7 @@
#include "net/base/escape.h"
#include "net/base/net_errors.h"
#include "net/http/http_util.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutputSurface.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObject.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMessageEvent.h"
@@ -1757,49 +1759,28 @@ WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace(
return new WebStorageNamespaceImpl(session_storage_namespace_id_);
}
-WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D(
- const WebGraphicsContext3D::Attributes& attributes) {
- if (!webview())
+WebKit::WebCompositorOutputSurface* RenderViewImpl::createOutputSurface() {
+ // TODO(aelias): if force-software-mode is on, create an output surface
+ // without a 3D context.
+
+ // Explicitly disable antialiasing for the compositor. As of the time of
+ // this writing, the only platform that supported antialiasing for the
+ // compositor was Mac OS X, because the on-screen OpenGL context creation
+ // code paths on Windows and Linux didn't yet have multisampling support.
+ // Mac OS X essentially always behaves as though it's rendering offscreen.
+ // Multisampling has a heavy cost especially on devices with relatively low
+ // fill rate like most notebooks, and the Mac implementation would need to
+ // be optimized to resolve directly into the IOSurface shared between the
+ // GPU and browser processes. For these reasons and to avoid platform
+ // disparities we explicitly disable antialiasing.
+ WebKit::WebGraphicsContext3D::Attributes attributes;
+ attributes.antialias = false;
+ attributes.shareResources = true;
+ WebGraphicsContext3D* context = CreateGraphicsContext3D(attributes);
+ if (!context)
return NULL;
- if (GetGuestToEmbedderChannel()) {
- WebGraphicsContext3DCommandBufferImpl* context =
- GetGuestToEmbedderChannel()->CreateWebGraphicsContext3D(
- this, attributes, false);
- if (!guest_pp_instance()) {
- guest_uninitialized_context_ = context;
- guest_attributes_ = attributes;
- }
- return context;
- }
-
- // The WebGraphicsContext3DInProcessImpl code path is used for
- // layout tests (though not through this code) as well as for
- // debugging and bringing up new ports.
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) {
- return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView(
- attributes, true);
- } else {
- GURL url;
- if (webview()->mainFrame())
- url = GURL(webview()->mainFrame()->document().url());
- else
- url = GURL("chrome://gpu/RenderViewImpl::createGraphicsContext3D");
-
- scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
- new WebGraphicsContext3DCommandBufferImpl(
- surface_id(),
- url,
- RenderThreadImpl::current(),
- AsWeakPtr()));
-
- if (!context->Initialize(
- attributes,
- false /* bind generates resources */,
- content::CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE))
- return NULL;
- return context.release();
- }
+ return new CompositorOutputSurface(routing_id(), context);
}
void RenderViewImpl::didAddMessageToConsole(
@@ -3574,6 +3555,51 @@ void RenderViewImpl::CheckPreferredSize() {
preferred_size_));
}
+WebGraphicsContext3D* RenderViewImpl::CreateGraphicsContext3D(
+ const WebGraphicsContext3D::Attributes& attributes) {
+ if (!webview())
+ return NULL;
+
+ if (GetGuestToEmbedderChannel()) {
+ WebGraphicsContext3DCommandBufferImpl* context =
+ GetGuestToEmbedderChannel()->CreateWebGraphicsContext3D(
+ this, attributes, false);
+ if (!guest_pp_instance()) {
+ guest_uninitialized_context_ = context;
+ guest_attributes_ = attributes;
+ }
+ return context;
+ }
+
+ // The WebGraphicsContext3DInProcessImpl code path is used for
+ // layout tests (though not through this code) as well as for
+ // debugging and bringing up new ports.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) {
+ return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView(
+ attributes, true);
+ } else {
+ GURL url;
+ if (webview()->mainFrame())
+ url = GURL(webview()->mainFrame()->document().url());
+ else
+ url = GURL("chrome://gpu/RenderViewImpl::createGraphicsContext3D");
+
+ scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
+ new WebGraphicsContext3DCommandBufferImpl(
+ surface_id(),
+ url,
+ RenderThreadImpl::current(),
+ AsWeakPtr()));
+
+ if (!context->Initialize(
+ attributes,
+ false /* bind generates resources */,
+ content::CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE))
+ return NULL;
+ return context.release();
+ }
+}
+
void RenderViewImpl::EnsureMediaStreamImpl() {
if (!RenderThreadImpl::current()) // Will be NULL during unit tests.
return;
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | ipc/ipc_forwarding_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698