summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 20:19:00 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 20:19:00 +0000
commita442180f04ae8958e36e8f2b6f068d1e4db6a3bc (patch)
tree1214069e6c74d75fd310764f458b711fc64d7d04
parent84638c7803f273f97679ea948609c05f6d5cbafa (diff)
downloadchromium_src-a442180f04ae8958e36e8f2b6f068d1e4db6a3bc.zip
chromium_src-a442180f04ae8958e36e8f2b6f068d1e4db6a3bc.tar.gz
chromium_src-a442180f04ae8958e36e8f2b6f068d1e4db6a3bc.tar.bz2
Add --enable-gpu-rendering instead of relying on a hardcoded constant.
BUG=33329 TEST=try it out on linux!! Review URL: http://codereview.chromium.org/661331 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40412 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc18
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.h3
-rw-r--r--chrome/common/chrome_switches.cc3
-rw-r--r--chrome/common/chrome_switches.h1
4 files changed, 18 insertions, 7 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index 89c8c8b..c3f860b 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -20,6 +20,7 @@
#include "app/gfx/gtk_util.h"
#include "app/l10n_util.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
@@ -32,6 +33,7 @@
#include "chrome/browser/renderer_host/gtk_key_bindings_handler.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "chrome/browser/renderer_host/video_layer_x.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/native_web_keyboard_event.h"
#include "chrome/common/x11_util.h"
#include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h"
@@ -40,10 +42,6 @@
static const int kMaxWindowWidth = 4000;
static const int kMaxWindowHeight = 4000;
-// True if we're doing out-of-process painting via the GPU process.
-// TODO(brettw) make this a command line option.
-static const bool kUseGPURendering = false;
-
static const char* kRenderWidgetHostViewKey = "__RENDER_WIDGET_HOST_VIEW__";
using WebKit::WebInputEventFactory;
@@ -323,6 +321,7 @@ RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host)
: host_(widget_host),
+ enable_gpu_rendering_(false),
about_to_validate_and_paint_(false),
is_hidden_(false),
is_loading_(false),
@@ -333,6 +332,11 @@ RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host)
is_popup_first_mouse_release_(true),
was_focused_before_grab_(false) {
host_->set_view(this);
+
+ // Enable experimental out-of-process GPU rendering.
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ enable_gpu_rendering_ =
+ command_line->HasSwitch(switches::kEnableGPURendering);
}
RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() {
@@ -618,7 +622,7 @@ void RenderWidgetHostViewGtk::AppendInputMethodsContextMenu(MenuGtk* menu) {
BackingStore* RenderWidgetHostViewGtk::AllocBackingStore(
const gfx::Size& size) {
- if (kUseGPURendering) {
+ if (enable_gpu_rendering_) {
// Use a special GPU accelerated backing store.
if (!gpu_view_host_.get()) {
// Here we lazily make the GpuViewHost. This must be allocated when we
@@ -637,7 +641,7 @@ BackingStore* RenderWidgetHostViewGtk::AllocBackingStore(
}
VideoLayer* RenderWidgetHostViewGtk::AllocVideoLayer(const gfx::Size& size) {
- if (kUseGPURendering) {
+ if (enable_gpu_rendering_) {
NOTIMPLEMENTED();
return NULL;
}
@@ -653,7 +657,7 @@ void RenderWidgetHostViewGtk::SetBackground(const SkBitmap& background) {
}
void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) {
- if (kUseGPURendering) {
+ if (enable_gpu_rendering_) {
// When we're proxying painting, we don't actually display the web page
// ourselves.
if (gpu_view_host_.get())
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
index 974a4eb..0b05d0b 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
@@ -102,6 +102,9 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView {
// The native UI widget.
OwnedWidgetGtk view_;
+ // Cached value of --enable-gpu-rendering for out-of-process painting.
+ bool enable_gpu_rendering_;
+
// Non-NULL when we're doing out-of-process painting.
scoped_ptr<GpuViewHost> gpu_view_host_;
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 0093fe6..feb90fb 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -254,6 +254,9 @@ const char kEnableIPv6[] = "enable-ipv6";
// Enable the GPU plugin and Pepper 3D rendering.
const char kEnableGPUPlugin[] = "enable-gpu-plugin";
+// Enable experimental GPU rendering for backing store and video.
+const char kEnableGPURendering[] = "enable-gpu-rendering";
+
// Force logging to be enabled. Logging is disabled by default in release
// builds.
const char kEnableLogging[] = "enable-logging";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 59fc3e6..9d8e28f 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -86,6 +86,7 @@ extern const char kEnableFastback[];
extern const char kEnableFileCookies[];
extern const char kEnableGeolocation[];
extern const char kEnableGPUPlugin[];
+extern const char kEnableGPURendering[];
extern const char kEnableIndexedDatabase[];
extern const char kEnableIPv6[];
extern const char kEnableLogging[];