OLD | NEW |
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 static v8::Handle<v8::Value> GetRenderingStats(const v8::Arguments& args) { | 153 static v8::Handle<v8::Value> GetRenderingStats(const v8::Arguments& args) { |
154 WebFrame* web_frame = WebFrame::frameForEnteredContext(); | 154 WebFrame* web_frame = WebFrame::frameForEnteredContext(); |
155 if (!web_frame) | 155 if (!web_frame) |
156 return v8::Undefined(); | 156 return v8::Undefined(); |
157 | 157 |
158 WebView* web_view = web_frame->view(); | 158 WebView* web_view = web_frame->view(); |
159 if (!web_view) | 159 if (!web_view) |
160 return v8::Undefined(); | 160 return v8::Undefined(); |
161 | 161 |
| 162 RenderViewImpl* render_view_impl = RenderViewImpl::FromWebView(web_view); |
| 163 if (!render_view_impl) |
| 164 return v8::Undefined(); |
| 165 |
162 WebRenderingStats stats; | 166 WebRenderingStats stats; |
163 web_view->renderingStats(stats); | 167 render_view_impl->GetRenderingStats(stats); |
164 | 168 |
165 v8::Handle<v8::Object> stats_object = v8::Object::New(); | 169 v8::Handle<v8::Object> stats_object = v8::Object::New(); |
166 if (stats.numAnimationFrames) | 170 if (stats.numAnimationFrames) |
167 stats_object->Set(v8::String::New("numAnimationFrames"), | 171 stats_object->Set(v8::String::New("numAnimationFrames"), |
168 v8::Integer::New(stats.numAnimationFrames), | 172 v8::Integer::New(stats.numAnimationFrames), |
169 v8::ReadOnly); | 173 v8::ReadOnly); |
170 if (stats.numFramesSentToScreen) | 174 if (stats.numFramesSentToScreen) |
171 stats_object->Set(v8::String::New("numFramesSentToScreen"), | 175 stats_object->Set(v8::String::New("numFramesSentToScreen"), |
172 v8::Integer::New(stats.numFramesSentToScreen), | 176 v8::Integer::New(stats.numFramesSentToScreen), |
173 v8::ReadOnly); | 177 v8::ReadOnly); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 298 |
295 return results.results_array(); | 299 return results.results_array(); |
296 } | 300 } |
297 }; | 301 }; |
298 | 302 |
299 v8::Extension* GpuBenchmarkingExtension::Get() { | 303 v8::Extension* GpuBenchmarkingExtension::Get() { |
300 return new GpuBenchmarkingWrapper(); | 304 return new GpuBenchmarkingWrapper(); |
301 } | 305 } |
302 | 306 |
303 } // namespace content | 307 } // namespace content |
OLD | NEW |