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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 if (name->Equals(v8::String::New("BeginSmoothScroll"))) | 170 if (name->Equals(v8::String::New("BeginSmoothScroll"))) |
171 return v8::FunctionTemplate::New(BeginSmoothScroll); | 171 return v8::FunctionTemplate::New(BeginSmoothScroll); |
172 if (name->Equals(v8::String::New("RunRenderingBenchmarks"))) | 172 if (name->Equals(v8::String::New("RunRenderingBenchmarks"))) |
173 return v8::FunctionTemplate::New(RunRenderingBenchmarks); | 173 return v8::FunctionTemplate::New(RunRenderingBenchmarks); |
174 | 174 |
175 return v8::Handle<v8::FunctionTemplate>(); | 175 return v8::Handle<v8::FunctionTemplate>(); |
176 } | 176 } |
177 | 177 |
178 static v8::Handle<v8::Value> GetRenderingStats(const v8::Arguments& args) { | 178 static v8::Handle<v8::Value> GetRenderingStats(const v8::Arguments& args) { |
179 | 179 |
180 WebFrame* web_frame = WebFrame::frameForEnteredContext(); | 180 WebFrame* web_frame = WebFrame::frameForCurrentContext(); |
181 if (!web_frame) | 181 if (!web_frame) |
182 return v8::Undefined(); | 182 return v8::Undefined(); |
183 | 183 |
184 WebView* web_view = web_frame->view(); | 184 WebView* web_view = web_frame->view(); |
185 if (!web_view) | 185 if (!web_view) |
186 return v8::Undefined(); | 186 return v8::Undefined(); |
187 | 187 |
188 RenderViewImpl* render_view_impl = RenderViewImpl::FromWebView(web_view); | 188 RenderViewImpl* render_view_impl = RenderViewImpl::FromWebView(web_view); |
189 if (!render_view_impl) | 189 if (!render_view_impl) |
190 return v8::Undefined(); | 190 return v8::Undefined(); |
(...skipping 12 matching lines...) Expand all Loading... |
203 } | 203 } |
204 | 204 |
205 static v8::Handle<v8::Value> PrintToSkPicture(const v8::Arguments& args) { | 205 static v8::Handle<v8::Value> PrintToSkPicture(const v8::Arguments& args) { |
206 if (args.Length() != 1) | 206 if (args.Length() != 1) |
207 return v8::Undefined(); | 207 return v8::Undefined(); |
208 | 208 |
209 v8::String::AsciiValue dirname(args[0]); | 209 v8::String::AsciiValue dirname(args[0]); |
210 if (dirname.length() == 0) | 210 if (dirname.length() == 0) |
211 return v8::Undefined(); | 211 return v8::Undefined(); |
212 | 212 |
213 WebFrame* web_frame = WebFrame::frameForEnteredContext(); | 213 WebFrame* web_frame = WebFrame::frameForCurrentContext(); |
214 if (!web_frame) | 214 if (!web_frame) |
215 return v8::Undefined(); | 215 return v8::Undefined(); |
216 | 216 |
217 WebView* web_view = web_frame->view(); | 217 WebView* web_view = web_frame->view(); |
218 if (!web_view) | 218 if (!web_view) |
219 return v8::Undefined(); | 219 return v8::Undefined(); |
220 | 220 |
221 WebViewBenchmarkSupport* benchmark_support = web_view->benchmarkSupport(); | 221 WebViewBenchmarkSupport* benchmark_support = web_view->benchmarkSupport(); |
222 if (!benchmark_support) | 222 if (!benchmark_support) |
223 return v8::Undefined(); | 223 return v8::Undefined(); |
(...skipping 23 matching lines...) Expand all Loading... |
247 frame->callFunctionEvenIfScriptDisabled(callback, | 247 frame->callFunctionEvenIfScriptDisabled(callback, |
248 v8::Object::New(), | 248 v8::Object::New(), |
249 0, | 249 0, |
250 NULL); | 250 NULL); |
251 } | 251 } |
252 callback.Dispose(); | 252 callback.Dispose(); |
253 context.Dispose(); | 253 context.Dispose(); |
254 } | 254 } |
255 | 255 |
256 static v8::Handle<v8::Value> BeginSmoothScroll(const v8::Arguments& args) { | 256 static v8::Handle<v8::Value> BeginSmoothScroll(const v8::Arguments& args) { |
257 WebFrame* web_frame = WebFrame::frameForEnteredContext(); | 257 WebFrame* web_frame = WebFrame::frameForCurrentContext(); |
258 if (!web_frame) | 258 if (!web_frame) |
259 return v8::Undefined(); | 259 return v8::Undefined(); |
260 | 260 |
261 WebView* web_view = web_frame->view(); | 261 WebView* web_view = web_frame->view(); |
262 if (!web_view) | 262 if (!web_view) |
263 return v8::Undefined(); | 263 return v8::Undefined(); |
264 | 264 |
265 RenderViewImpl* render_view_impl = RenderViewImpl::FromWebView(web_view); | 265 RenderViewImpl* render_view_impl = RenderViewImpl::FromWebView(web_view); |
266 if (!render_view_impl) | 266 if (!render_view_impl) |
267 return v8::Undefined(); | 267 return v8::Undefined(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 330 |
331 std::string name_filter; | 331 std::string name_filter; |
332 if (args[0]->IsNull() || args[0]->IsUndefined()) { | 332 if (args[0]->IsNull() || args[0]->IsUndefined()) { |
333 name_filter = ""; | 333 name_filter = ""; |
334 } else { | 334 } else { |
335 char filter[256]; | 335 char filter[256]; |
336 args[0]->ToString()->WriteAscii(filter, 0, sizeof(filter)-1); | 336 args[0]->ToString()->WriteAscii(filter, 0, sizeof(filter)-1); |
337 name_filter = std::string(filter); | 337 name_filter = std::string(filter); |
338 } | 338 } |
339 | 339 |
340 WebFrame* web_frame = WebFrame::frameForEnteredContext(); | 340 WebFrame* web_frame = WebFrame::frameForCurrentContext(); |
341 if (!web_frame) | 341 if (!web_frame) |
342 return v8::Undefined(); | 342 return v8::Undefined(); |
343 | 343 |
344 WebView* web_view = web_frame->view(); | 344 WebView* web_view = web_frame->view(); |
345 if (!web_view) | 345 if (!web_view) |
346 return v8::Undefined(); | 346 return v8::Undefined(); |
347 | 347 |
348 WebViewBenchmarkSupport* support = web_view->benchmarkSupport(); | 348 WebViewBenchmarkSupport* support = web_view->benchmarkSupport(); |
349 if (!support) | 349 if (!support) |
350 return v8::Undefined(); | 350 return v8::Undefined(); |
(...skipping 22 matching lines...) Expand all Loading... |
373 | 373 |
374 return results; | 374 return results; |
375 } | 375 } |
376 }; | 376 }; |
377 | 377 |
378 v8::Extension* GpuBenchmarkingExtension::Get() { | 378 v8::Extension* GpuBenchmarkingExtension::Get() { |
379 return new GpuBenchmarkingWrapper(); | 379 return new GpuBenchmarkingWrapper(); |
380 } | 380 } |
381 | 381 |
382 } // namespace content | 382 } // namespace content |
OLD | NEW |