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

Unified Diff: content/renderer/gpu/gpu_benchmarking_extension.cc

Issue 10787025: Expose a gpu-benchmark-only measureRecordTime API to JS. This function measures the time it takes t… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/gpu_benchmarking_extension.cc
===================================================================
--- content/renderer/gpu/gpu_benchmarking_extension.cc (revision 146858)
+++ content/renderer/gpu/gpu_benchmarking_extension.cc (working copy)
@@ -35,6 +35,11 @@
" native function GetRenderingStats();"
" return GetRenderingStats();"
"};"
+ "chrome.gpuBenchmarking.measureRecordTime = function(dump) {"
nduca 2012/07/16 22:28:40 How about dumpToSkPicture = function(filename)
alokp 2012/07/16 22:38:09 I chose this name because it seemed more appropria
dmurph 2012/07/17 00:11:54 There's a sister patch for all rending microbenchm
+ " dump = dump || false;"
+ " native function MeasureRecordTime();"
+ " return MeasureRecordTime(dump);"
+ "};"
"chrome.gpuBenchmarking.beginSmoothScrollDown = "
" function(scroll_far) {"
" scroll_far = scroll_far || false;"
@@ -51,6 +56,8 @@
v8::Handle<v8::String> name) {
if (name->Equals(v8::String::New("GetRenderingStats")))
return v8::FunctionTemplate::New(GetRenderingStats);
+ if (name->Equals(v8::String::New("MeasureRecordTime")))
+ return v8::FunctionTemplate::New(MeasureRecordTime);
if (name->Equals(v8::String::New("BeginSmoothScroll")))
return v8::FunctionTemplate::New(BeginSmoothScroll);
@@ -81,6 +88,30 @@
return stats_object;
}
+ static v8::Handle<v8::Value> MeasureRecordTime(const v8::Arguments& args) {
+ if (args.Length() != 1 || !args[0]->IsBoolean())
+ return v8::False();
+ bool dump = args[0]->BooleanValue();
+
+ WebFrame* web_frame = WebFrame::frameForEnteredContext();
+ if (!web_frame)
+ return v8::Undefined();
+
+ WebView* web_view = web_frame->view();
+ if (!web_view)
+ return v8::Undefined();
+
+ // TODO(alokp): Implement recroding time after patch for WKBUG 88271 lands.
+ double record_time = 0.0;
+ if (dump) {
nduca 2012/07/16 22:28:40 I'm not sure you need to measure recording time. Y
+ // Launch file chooser dialog to select the file into which the
+ // resulting SkPicture will be dumped.
nduca 2012/07/16 22:28:40 Use the filename that the script provides. The aut
alokp 2012/07/16 22:38:09 Makes it even easier. Will do.
+ // Note that for this to work Chrome needs to be launched with
+ // --no-sandbox command-line flag.
+ }
+ return v8::Number::New(record_time);
+ }
+
static v8::Handle<v8::Value> BeginSmoothScroll(const v8::Arguments& args) {
WebFrame* web_frame = WebFrame::frameForEnteredContext();
if (!web_frame)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698