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

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

Issue 10818038: Make GPU benchmarking numAnimationFrames and totalPaintTime work in software mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Calculate software paint time in RenderWidget. 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 | « no previous file | content/renderer/render_widget.h » ('j') | content/renderer/render_widget.cc » ('J')
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/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "content/public/renderer/render_thread.h" 10 #include "content/public/renderer/render_thread.h"
11 #include "content/renderer/all_rendering_benchmarks.h" 11 #include "content/renderer/all_rendering_benchmarks.h"
12 #include "content/renderer/rendering_benchmark.h" 12 #include "content/renderer/rendering_benchmark.h"
13 #include "content/renderer/rendering_benchmark_results.h" 13 #include "content/renderer/rendering_benchmark_results.h"
14 #include "content/renderer/render_view_impl.h" 14 #include "content/renderer/render_view_impl.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h " 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h "
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewBenchmarkSuppo rt.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewBenchmarkSuppo rt.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
19 #include "v8/include/v8.h" 19 #include "v8/include/v8.h"
20 20
21 using WebKit::WebFrame; 21 using WebKit::WebFrame;
22 using WebKit::WebPrivatePtr; 22 using WebKit::WebPrivatePtr;
23 using WebKit::WebViewBenchmarkSupport; 23 using WebKit::WebViewBenchmarkSupport;
24 using WebKit::WebRenderingStats; 24 using WebKit::WebRenderingStats;
25 using WebKit::WebView; 25 using WebKit::WebView;
26 26
27 const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking"; 27 const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking";
28 28
29 using WebKit::WebFrame;
30 using WebKit::WebView;
31
32 namespace content { 29 namespace content {
33 30
34 // Benchmark results object that populates a v8 array. 31 // Benchmark results object that populates a v8 array.
35 class V8BenchmarkResults : public content::RenderingBenchmarkResults { 32 class V8BenchmarkResults : public content::RenderingBenchmarkResults {
36 public: 33 public:
37 explicit V8BenchmarkResults() 34 explicit V8BenchmarkResults()
38 : results_array_(v8::Array::New(0)) { } 35 : results_array_(v8::Array::New(0)) { }
39 virtual ~V8BenchmarkResults() {} 36 virtual ~V8BenchmarkResults() {}
40 37
41 void AddResult(const std::string& benchmark_name, 38 void AddResult(const std::string& benchmark_name,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 103
107 static v8::Handle<v8::Value> GetRenderingStats(const v8::Arguments& args) { 104 static v8::Handle<v8::Value> GetRenderingStats(const v8::Arguments& args) {
108 WebFrame* web_frame = WebFrame::frameForEnteredContext(); 105 WebFrame* web_frame = WebFrame::frameForEnteredContext();
109 if (!web_frame) 106 if (!web_frame)
110 return v8::Undefined(); 107 return v8::Undefined();
111 108
112 WebView* web_view = web_frame->view(); 109 WebView* web_view = web_frame->view();
113 if (!web_view) 110 if (!web_view)
114 return v8::Undefined(); 111 return v8::Undefined();
115 112
113 RenderViewImpl* render_view_impl = RenderViewImpl::FromWebView(web_view);
114 if (!render_view_impl)
115 return v8::Undefined();
116
116 WebRenderingStats stats; 117 WebRenderingStats stats;
117 web_view->renderingStats(stats); 118 render_view_impl->GetRenderingStats(stats);
118 119
119 v8::Handle<v8::Object> stats_object = v8::Object::New(); 120 v8::Handle<v8::Object> stats_object = v8::Object::New();
120 if (stats.numAnimationFrames) 121 if (stats.numAnimationFrames)
121 stats_object->Set(v8::String::New("numAnimationFrames"), 122 stats_object->Set(v8::String::New("numAnimationFrames"),
122 v8::Integer::New(stats.numAnimationFrames), 123 v8::Integer::New(stats.numAnimationFrames),
123 v8::ReadOnly); 124 v8::ReadOnly);
124 if (stats.numFramesSentToScreen) 125 if (stats.numFramesSentToScreen)
125 stats_object->Set(v8::String::New("numFramesSentToScreen"), 126 stats_object->Set(v8::String::New("numFramesSentToScreen"),
126 v8::Integer::New(stats.numFramesSentToScreen), 127 v8::Integer::New(stats.numFramesSentToScreen),
127 v8::ReadOnly); 128 v8::ReadOnly);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 213
213 return results.results_array(); 214 return results.results_array();
214 } 215 }
215 }; 216 };
216 217
217 v8::Extension* GpuBenchmarkingExtension::Get() { 218 v8::Extension* GpuBenchmarkingExtension::Get() {
218 return new GpuBenchmarkingWrapper(); 219 return new GpuBenchmarkingWrapper();
219 } 220 }
220 221
221 } // namespace content 222 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_widget.h » ('j') | content/renderer/render_widget.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698