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

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

Issue 190693002: Migrate Telemetry from beginWindowSnapshotPNG to Page.captureScreenshot (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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 | « content/public/browser/render_widget_host.h ('k') | content/renderer/render_view_impl.h » ('j') | 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/base64.h" 9 #include "base/base64.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 " function(position_x, position_y, opt_callback, opt_duration_ms," 303 " function(position_x, position_y, opt_callback, opt_duration_ms,"
304 " opt_gesture_source_type) {" 304 " opt_gesture_source_type) {"
305 " callback = opt_callback || function() { };" 305 " callback = opt_callback || function() { };"
306 " duration_ms = opt_duration_ms || 50;" 306 " duration_ms = opt_duration_ms || 50;"
307 " gesture_source_type = opt_gesture_source_type ||" 307 " gesture_source_type = opt_gesture_source_type ||"
308 " chrome.gpuBenchmarking.DEFAULT_INPUT;" 308 " chrome.gpuBenchmarking.DEFAULT_INPUT;"
309 " native function BeginTap();" 309 " native function BeginTap();"
310 " return BeginTap(position_x, position_y, callback, duration_ms," 310 " return BeginTap(position_x, position_y, callback, duration_ms,"
311 " gesture_source_type);" 311 " gesture_source_type);"
312 "};" 312 "};"
313 "chrome.gpuBenchmarking.beginWindowSnapshotPNG = function(callback) {"
314 " native function BeginWindowSnapshotPNG();"
315 " BeginWindowSnapshotPNG(callback);"
316 "};"
317 "chrome.gpuBenchmarking.clearImageCache = function() {" 313 "chrome.gpuBenchmarking.clearImageCache = function() {"
318 " native function ClearImageCache();" 314 " native function ClearImageCache();"
319 " ClearImageCache();" 315 " ClearImageCache();"
320 "};" 316 "};"
321 "chrome.gpuBenchmarking.runMicroBenchmark =" 317 "chrome.gpuBenchmarking.runMicroBenchmark ="
322 " function(name, callback, opt_arguments) {" 318 " function(name, callback, opt_arguments) {"
323 " arguments = opt_arguments || {};" 319 " arguments = opt_arguments || {};"
324 " native function RunMicroBenchmark();" 320 " native function RunMicroBenchmark();"
325 " return RunMicroBenchmark(name, callback, arguments);" 321 " return RunMicroBenchmark(name, callback, arguments);"
326 "};" 322 "};"
(...skipping 17 matching lines...) Expand all
344 v8::String::NewFromUtf8(isolate, "GestureSourceTypeSupported"))) 340 v8::String::NewFromUtf8(isolate, "GestureSourceTypeSupported")))
345 return v8::FunctionTemplate::New(isolate, GestureSourceTypeSupported); 341 return v8::FunctionTemplate::New(isolate, GestureSourceTypeSupported);
346 if (name->Equals(v8::String::NewFromUtf8(isolate, "BeginSmoothScroll"))) 342 if (name->Equals(v8::String::NewFromUtf8(isolate, "BeginSmoothScroll")))
347 return v8::FunctionTemplate::New(isolate, BeginSmoothScroll); 343 return v8::FunctionTemplate::New(isolate, BeginSmoothScroll);
348 if (name->Equals(v8::String::NewFromUtf8(isolate, "BeginScrollBounce"))) 344 if (name->Equals(v8::String::NewFromUtf8(isolate, "BeginScrollBounce")))
349 return v8::FunctionTemplate::New(isolate, BeginScrollBounce); 345 return v8::FunctionTemplate::New(isolate, BeginScrollBounce);
350 if (name->Equals(v8::String::NewFromUtf8(isolate, "BeginPinch"))) 346 if (name->Equals(v8::String::NewFromUtf8(isolate, "BeginPinch")))
351 return v8::FunctionTemplate::New(isolate, BeginPinch); 347 return v8::FunctionTemplate::New(isolate, BeginPinch);
352 if (name->Equals(v8::String::NewFromUtf8(isolate, "BeginTap"))) 348 if (name->Equals(v8::String::NewFromUtf8(isolate, "BeginTap")))
353 return v8::FunctionTemplate::New(isolate, BeginTap); 349 return v8::FunctionTemplate::New(isolate, BeginTap);
354 if (name->Equals(
355 v8::String::NewFromUtf8(isolate, "BeginWindowSnapshotPNG")))
356 return v8::FunctionTemplate::New(isolate, BeginWindowSnapshotPNG);
357 if (name->Equals(v8::String::NewFromUtf8(isolate, "ClearImageCache"))) 350 if (name->Equals(v8::String::NewFromUtf8(isolate, "ClearImageCache")))
358 return v8::FunctionTemplate::New(isolate, ClearImageCache); 351 return v8::FunctionTemplate::New(isolate, ClearImageCache);
359 if (name->Equals(v8::String::NewFromUtf8(isolate, "RunMicroBenchmark"))) 352 if (name->Equals(v8::String::NewFromUtf8(isolate, "RunMicroBenchmark")))
360 return v8::FunctionTemplate::New(isolate, RunMicroBenchmark); 353 return v8::FunctionTemplate::New(isolate, RunMicroBenchmark);
361 if (name->Equals(v8::String::NewFromUtf8(isolate, "HasGpuProcess"))) 354 if (name->Equals(v8::String::NewFromUtf8(isolate, "HasGpuProcess")))
362 return v8::FunctionTemplate::New(isolate, HasGpuProcess); 355 return v8::FunctionTemplate::New(isolate, HasGpuProcess);
363 356
364 return v8::Handle<v8::FunctionTemplate>(); 357 return v8::Handle<v8::FunctionTemplate>();
365 } 358 }
366 359
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 v8::Handle<v8::Value> argv[] = { result }; 776 v8::Handle<v8::Value> argv[] = { result };
784 777
785 frame->callFunctionEvenIfScriptDisabled( 778 frame->callFunctionEvenIfScriptDisabled(
786 callback_and_context->GetCallback(), 779 callback_and_context->GetCallback(),
787 v8::Object::New(isolate), 780 v8::Object::New(isolate),
788 1, 781 1,
789 argv); 782 argv);
790 } 783 }
791 } 784 }
792 785
793 static void BeginWindowSnapshotPNG(
794 const v8::FunctionCallbackInfo<v8::Value>& args) {
795 GpuBenchmarkingContext context;
796 if (!context.Init(false))
797 return;
798
799 if (!args[0]->IsFunction())
800 return;
801
802 v8::Local<v8::Function> callback_local =
803 v8::Local<v8::Function>::Cast(args[0]);
804
805 scoped_refptr<CallbackAndContext> callback_and_context =
806 new CallbackAndContext(args.GetIsolate(),
807 callback_local,
808 context.web_frame()->mainWorldScriptContext());
809
810 context.render_view_impl()->GetWindowSnapshot(
811 base::Bind(&OnSnapshotCompleted, callback_and_context));
812 }
813
814 static void ClearImageCache( 786 static void ClearImageCache(
815 const v8::FunctionCallbackInfo<v8::Value>& args) { 787 const v8::FunctionCallbackInfo<v8::Value>& args) {
816 WebImageCache::clear(); 788 WebImageCache::clear();
817 } 789 }
818 790
819 static void OnMicroBenchmarkCompleted( 791 static void OnMicroBenchmarkCompleted(
820 CallbackAndContext* callback_and_context, 792 CallbackAndContext* callback_and_context,
821 scoped_ptr<base::Value> result) { 793 scoped_ptr<base::Value> result) {
822 v8::Isolate* isolate = callback_and_context->isolate(); 794 v8::Isolate* isolate = callback_and_context->isolate();
823 v8::HandleScope scope(isolate); 795 v8::HandleScope scope(isolate);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); 852 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel();
881 args.GetReturnValue().Set(!!gpu_channel); 853 args.GetReturnValue().Set(!!gpu_channel);
882 } 854 }
883 }; 855 };
884 856
885 v8::Extension* GpuBenchmarkingExtension::Get() { 857 v8::Extension* GpuBenchmarkingExtension::Get() {
886 return new GpuBenchmarkingWrapper(); 858 return new GpuBenchmarkingWrapper();
887 } 859 }
888 860
889 } // namespace content 861 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/render_widget_host.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698