summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordmurph@chromium.org <dmurph@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-12 19:40:01 +0000
committerdmurph@chromium.org <dmurph@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-12 19:40:01 +0000
commite54ab49e95a0aae95971ef208e7d99d9160c354d (patch)
treea5385a06518d6dc5e2f213bc0dc4db869aa171e4
parent11958ef23bef0529257b0d9f2abbfa693322db28 (diff)
downloadchromium_src-e54ab49e95a0aae95971ef208e7d99d9160c354d.zip
chromium_src-e54ab49e95a0aae95971ef208e7d99d9160c354d.tar.gz
chromium_src-e54ab49e95a0aae95971ef208e7d99d9160c354d.tar.bz2
added gpu_benchmarking_extension boilerplate and hooked it up to a new switch.
Review URL: https://chromiumcodereview.appspot.com/10532058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141710 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc1
-rw-r--r--content/content_renderer.gypi2
-rw-r--r--content/public/common/content_switches.cc3
-rw-r--r--content/public/common/content_switches.h1
-rw-r--r--content/renderer/gpu/gpu_benchmarking_extension.cc34
-rw-r--r--content/renderer/gpu/gpu_benchmarking_extension.h23
-rw-r--r--content/renderer/render_thread_impl.cc6
7 files changed, 69 insertions, 1 deletions
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index c8716d7..e5d80c3 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -678,6 +678,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnableGamepad,
switches::kEnableGPUServiceLogging,
switches::kEnableGPUClientLogging,
+ switches::kEnableGpuBenchmarking,
switches::kEnableLogging,
switches::kEnableMediaSource,
switches::kEnablePartialSwap,
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 26d5ec7..241db2f 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -77,6 +77,8 @@
'renderer/gpu/compositor_thread.h',
'renderer/gpu/input_event_filter.cc',
'renderer/gpu/input_event_filter.h',
+ 'renderer/gpu/gpu_benchmarking_extension.cc',
+ 'renderer/gpu/gpu_benchmarking_extension.h',
'renderer/idle_user_detector.cc',
'renderer/idle_user_detector.h',
'renderer/input_tag_speech_dispatcher.cc',
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index d7186e4..8c25d81 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -278,6 +278,9 @@ const char kEnablePointerLock[] = "enable-pointer-lock";
// Enable the Gamepad API
const char kEnableGamepad[] = "enable-gamepad";
+// Enables the GPU benchmarking extension
+const char kEnableGpuBenchmarking[] = "enable-gpu-benchmarking";
+
// Force logging to be enabled. Logging is disabled by default in release
// builds.
const char kEnableLogging[] = "enable-logging";
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index 6a58f4b..674ebf7 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -95,6 +95,7 @@ CONTENT_EXPORT extern const char kEnableFixedLayout[];
CONTENT_EXPORT extern const char kDisableFullScreen[];
extern const char kEnablePointerLock[];
extern const char kEnableGamepad[];
+extern const char kEnableGpuBenchmarking[];
CONTENT_EXPORT extern const char kEnableLogging[];
extern const char kEnableMediaSource[];
extern const char kEnablePeerConnection[];
diff --git a/content/renderer/gpu/gpu_benchmarking_extension.cc b/content/renderer/gpu/gpu_benchmarking_extension.cc
new file mode 100644
index 0000000..06bf193
--- /dev/null
+++ b/content/renderer/gpu/gpu_benchmarking_extension.cc
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 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 "content/renderer/gpu/gpu_benchmarking_extension.h"
+
+#include "v8/include/v8.h"
+
+const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking";
+
+namespace content {
+
+class GpuBenchmarkingWrapper : public v8::Extension {
+ public:
+ GpuBenchmarkingWrapper() :
+ v8::Extension(kGpuBenchmarkingExtensionName,
+ "if (typeof(chrome) == 'undefined') {"
+ " chrome = {};"
+ "};"
+ "if (typeof(chrome.gpuBenchmarking) == 'undefined') {"
+ " chrome.gpuBenchmarking = {};"
+ "};") {}
+
+ virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
+ v8::Handle<v8::String> name) {
+ return v8::Handle<v8::FunctionTemplate>();
+ }
+};
+
+v8::Extension* GpuBenchmarkingExtension::Get() {
+ return new GpuBenchmarkingWrapper();
+}
+
+} // namespace content
diff --git a/content/renderer/gpu/gpu_benchmarking_extension.h b/content/renderer/gpu/gpu_benchmarking_extension.h
new file mode 100644
index 0000000..60f126d
--- /dev/null
+++ b/content/renderer/gpu/gpu_benchmarking_extension.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 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.
+
+#ifndef CONTENT_RENDERER_GPU_GPU_BENCHMARKING_EXTENSION_H_
+#define CONTENT_RENDERER_GPU_GPU_BENCHMARKING_EXTENSION_H_
+#pragma once
+
+namespace v8 {
+class Extension;
+}
+
+namespace content {
+
+// V8 extension for gpu benchmarking
+class GpuBenchmarkingExtension {
+ public:
+ static v8::Extension* Get();
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_GPU_GPU_BENCHMARKING_EXTENSION_H_
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index a22e6d2..d3729aa 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -53,6 +53,7 @@
#include "content/renderer/dom_storage/webstoragearea_impl.h"
#include "content/renderer/dom_storage/webstoragenamespace_impl.h"
#include "content/renderer/gpu/compositor_thread.h"
+#include "content/renderer/gpu/gpu_benchmarking_extension.h"
#include "content/renderer/media/audio_input_message_filter.h"
#include "content/renderer/media/audio_message_filter.h"
#include "content/renderer/media/media_stream_center.h"
@@ -241,8 +242,11 @@ void RenderThreadImpl::Init() {
content::GetContentClient()->renderer()->RenderThreadStarted();
-#if defined(WEBCOMPOSITOR_OWNS_SETTINGS)
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kEnableGpuBenchmarking))
+ RegisterExtension(content::GpuBenchmarkingExtension::Get());
+
+#if defined(WEBCOMPOSITOR_OWNS_SETTINGS)
WebKit::WebCompositor::setAcceleratedAnimationEnabled(
!command_line.HasSwitch(switches::kDisableThreadedAnimation));
WebKit::WebCompositor::setPerTilePaintingEnabled(