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

Side by Side Diff: content/renderer/gpu/gpu_benchmarking_extension.cc

Issue 10836202: Refactor/rewrite scroll.js, reporting results as renderingStats objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More changes. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/functional/perf.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/gpu/gpu_benchmarking_extension.h" 5 #include "content/renderer/gpu/gpu_benchmarking_extension.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return v8::Undefined(); 174 return v8::Undefined();
175 175
176 RenderViewImpl* render_view_impl = RenderViewImpl::FromWebView(web_view); 176 RenderViewImpl* render_view_impl = RenderViewImpl::FromWebView(web_view);
177 if (!render_view_impl) 177 if (!render_view_impl)
178 return v8::Undefined(); 178 return v8::Undefined();
179 179
180 WebRenderingStats stats; 180 WebRenderingStats stats;
181 render_view_impl->GetRenderingStats(stats); 181 render_view_impl->GetRenderingStats(stats);
182 182
183 v8::Handle<v8::Object> stats_object = v8::Object::New(); 183 v8::Handle<v8::Object> stats_object = v8::Object::New();
184 if (stats.numAnimationFrames) 184 stats_object->Set(v8::String::New("numAnimationFrames"),
185 stats_object->Set(v8::String::New("numAnimationFrames"), 185 v8::Integer::New(stats.numAnimationFrames));
186 v8::Integer::New(stats.numAnimationFrames), 186 stats_object->Set(v8::String::New("numFramesSentToScreen"),
187 v8::ReadOnly); 187 v8::Integer::New(stats.numFramesSentToScreen));
188 if (stats.numFramesSentToScreen) 188 stats_object->Set(v8::String::New("droppedFrameCount"),
189 stats_object->Set(v8::String::New("numFramesSentToScreen"), 189 v8::Integer::New(stats.droppedFrameCount));
190 v8::Integer::New(stats.numFramesSentToScreen), 190 stats_object->Set(v8::String::New("totalPaintTimeInSeconds"),
191 v8::ReadOnly); 191 v8::Number::New(stats.totalPaintTimeInSeconds));
192 if (stats.droppedFrameCount) 192 stats_object->Set(v8::String::New("totalRasterizeTimeInSeconds"),
193 stats_object->Set(v8::String::New("droppedFrameCount"), 193 v8::Number::New(stats.totalRasterizeTimeInSeconds));
194 v8::Integer::New(stats.droppedFrameCount),
195 v8::ReadOnly);
196 if (stats.totalPaintTimeInSeconds)
197 stats_object->Set(v8::String::New("totalPaintTimeInSeconds"),
198 v8::Number::New(stats.totalPaintTimeInSeconds),
199 v8::ReadOnly);
200 if (stats.totalRasterizeTimeInSeconds)
201 stats_object->Set(v8::String::New("totalRasterizeTimeInSeconds"),
202 v8::Number::New(stats.totalRasterizeTimeInSeconds),
203 v8::ReadOnly);
204 return stats_object; 194 return stats_object;
205 } 195 }
206 196
207 static v8::Handle<v8::Value> PrintToSkPicture(const v8::Arguments& args) { 197 static v8::Handle<v8::Value> PrintToSkPicture(const v8::Arguments& args) {
208 if (args.Length() != 1) 198 if (args.Length() != 1)
209 return v8::Undefined(); 199 return v8::Undefined();
210 200
211 v8::String::AsciiValue dirname(args[0]); 201 v8::String::AsciiValue dirname(args[0]);
212 if (dirname.length() == 0) 202 if (dirname.length() == 0)
213 return v8::Undefined(); 203 return v8::Undefined();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 302
313 return results.results_array(); 303 return results.results_array();
314 } 304 }
315 }; 305 };
316 306
317 v8::Extension* GpuBenchmarkingExtension::Get() { 307 v8::Extension* GpuBenchmarkingExtension::Get() {
318 return new GpuBenchmarkingWrapper(); 308 return new GpuBenchmarkingWrapper();
319 } 309 }
320 310
321 } // namespace content 311 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/functional/perf.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698