Chromium Code Reviews| 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) |