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

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: Initial commit. 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.h » ('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 #include "content/renderer/render_view_impl.h" 6 #include "content/renderer/render_view_impl.h"
7 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h " 7 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h "
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
11 #include "v8/include/v8.h" 9 #include "v8/include/v8.h"
12 10
13 using WebKit::WebFrame; 11 using WebKit::WebFrame;
14 using WebKit::WebRenderingStats; 12 using WebKit::WebRenderingStats;
15 using WebKit::WebView; 13 using WebKit::WebView;
16 14
17 const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking"; 15 const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking";
18 16
19 using WebKit::WebFrame; 17 using WebKit::WebFrame;
20 using WebKit::WebView; 18 using WebKit::WebView;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 57
60 static v8::Handle<v8::Value> GetRenderingStats(const v8::Arguments& args) { 58 static v8::Handle<v8::Value> GetRenderingStats(const v8::Arguments& args) {
61 WebFrame* web_frame = WebFrame::frameForEnteredContext(); 59 WebFrame* web_frame = WebFrame::frameForEnteredContext();
62 if (!web_frame) 60 if (!web_frame)
63 return v8::Undefined(); 61 return v8::Undefined();
64 62
65 WebView* web_view = web_frame->view(); 63 WebView* web_view = web_frame->view();
66 if (!web_view) 64 if (!web_view)
67 return v8::Undefined(); 65 return v8::Undefined();
68 66
67 RenderViewImpl* render_view_impl = RenderViewImpl::FromWebView(web_view);
68 if (!render_view_impl)
69 return v8::Undefined();
70
69 WebRenderingStats stats; 71 WebRenderingStats stats;
70 web_view->renderingStats(stats); 72 render_view_impl->GetRenderingStats(stats);
71 73
72 v8::Handle<v8::Object> stats_object = v8::Object::New(); 74 v8::Handle<v8::Object> stats_object = v8::Object::New();
73 if (stats.numAnimationFrames) 75 if (stats.numAnimationFrames)
74 stats_object->Set(v8::String::New("numAnimationFrames"), 76 stats_object->Set(v8::String::New("numAnimationFrames"),
75 v8::Integer::New(stats.numAnimationFrames), 77 v8::Integer::New(stats.numAnimationFrames),
76 v8::ReadOnly); 78 v8::ReadOnly);
77 if (stats.numFramesSentToScreen) 79 if (stats.numFramesSentToScreen)
78 stats_object->Set(v8::String::New("numFramesSentToScreen"), 80 stats_object->Set(v8::String::New("numFramesSentToScreen"),
79 v8::Integer::New(stats.numFramesSentToScreen), 81 v8::Integer::New(stats.numFramesSentToScreen),
80 v8::ReadOnly); 82 v8::ReadOnly);
83 if (stats.droppedFrameCount)
84 stats_object->Set(v8::String::New("droppedFrameCount"),
85 v8::Integer::New(stats.droppedFrameCount),
86 v8::ReadOnly);
87 if (stats.totalPaintTimeInSeconds)
88 stats_object->Set(v8::String::New("totalPaintTimeInSeconds"),
89 v8::Number::New(stats.totalPaintTimeInSeconds),
90 v8::ReadOnly);
91 if (stats.totalRasterizeTimeInSeconds)
92 stats_object->Set(v8::String::New("totalRasterizeTimeInSeconds"),
93 v8::Number::New(stats.totalRasterizeTimeInSeconds),
94 v8::ReadOnly);
81 return stats_object; 95 return stats_object;
82 } 96 }
83 97
84 static v8::Handle<v8::Value> BeginSmoothScroll(const v8::Arguments& args) { 98 static v8::Handle<v8::Value> BeginSmoothScroll(const v8::Arguments& args) {
85 WebFrame* web_frame = WebFrame::frameForEnteredContext(); 99 WebFrame* web_frame = WebFrame::frameForEnteredContext();
86 if (!web_frame) 100 if (!web_frame)
87 return v8::Undefined(); 101 return v8::Undefined();
88 102
89 WebView* web_view = web_frame->view(); 103 WebView* web_view = web_frame->view();
90 if (!web_view) 104 if (!web_view)
(...skipping 12 matching lines...) Expand all
103 render_view_impl->BeginSmoothScroll(scroll_down, scroll_far); 117 render_view_impl->BeginSmoothScroll(scroll_down, scroll_far);
104 return v8::True(); 118 return v8::True();
105 } 119 }
106 }; 120 };
107 121
108 v8::Extension* GpuBenchmarkingExtension::Get() { 122 v8::Extension* GpuBenchmarkingExtension::Get() {
109 return new GpuBenchmarkingWrapper(); 123 return new GpuBenchmarkingWrapper();
110 } 124 }
111 125
112 } // namespace content 126 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_widget.h » ('j') | content/renderer/render_widget.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698