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

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

Issue 657763002: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 else { 539 else {
540 args.GetReturnValue().Set(false); 540 args.GetReturnValue().Set(false);
541 return; 541 return;
542 } 542 }
543 gesture_params->distances.push_back(distance); 543 gesture_params->distances.push_back(distance);
544 544
545 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in 545 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in
546 // progress, we will leak the callback and context. This needs to be fixed, 546 // progress, we will leak the callback and context. This needs to be fixed,
547 // somehow. 547 // somehow.
548 context.render_view_impl()->QueueSyntheticGesture( 548 context.render_view_impl()->QueueSyntheticGesture(
549 gesture_params.PassAs<SyntheticGestureParams>(), 549 gesture_params.Pass(),
550 base::Bind(&OnSyntheticGestureCompleted, 550 base::Bind(&OnSyntheticGestureCompleted, callback_and_context));
551 callback_and_context));
552 551
553 args.GetReturnValue().Set(true); 552 args.GetReturnValue().Set(true);
554 } 553 }
555 554
556 static void BeginScrollBounce( 555 static void BeginScrollBounce(
557 const v8::FunctionCallbackInfo<v8::Value>& args) { 556 const v8::FunctionCallbackInfo<v8::Value>& args) {
558 GpuBenchmarkingContext context; 557 GpuBenchmarkingContext context;
559 if (!context.Init(false)) 558 if (!context.Init(false))
560 return; 559 return;
561 560
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 gesture_params->anchor = start; 632 gesture_params->anchor = start;
634 for (int i = 0; i < repeat_count; i++) { 633 for (int i = 0; i < repeat_count; i++) {
635 gesture_params->distances.push_back(distance); 634 gesture_params->distances.push_back(distance);
636 gesture_params->distances.push_back(-distance + overscroll); 635 gesture_params->distances.push_back(-distance + overscroll);
637 } 636 }
638 637
639 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in 638 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in
640 // progress, we will leak the callback and context. This needs to be fixed, 639 // progress, we will leak the callback and context. This needs to be fixed,
641 // somehow. 640 // somehow.
642 context.render_view_impl()->QueueSyntheticGesture( 641 context.render_view_impl()->QueueSyntheticGesture(
643 gesture_params.PassAs<SyntheticGestureParams>(), 642 gesture_params.Pass(),
644 base::Bind(&OnSyntheticGestureCompleted, 643 base::Bind(&OnSyntheticGestureCompleted, callback_and_context));
645 callback_and_context));
646 644
647 args.GetReturnValue().Set(true); 645 args.GetReturnValue().Set(true);
648 } 646 }
649 647
650 static void BeginPinch( 648 static void BeginPinch(
651 const v8::FunctionCallbackInfo<v8::Value>& args) { 649 const v8::FunctionCallbackInfo<v8::Value>& args) {
652 GpuBenchmarkingContext context; 650 GpuBenchmarkingContext context;
653 if (!context.Init(false)) 651 if (!context.Init(false))
654 return; 652 return;
655 653
(...skipping 27 matching lines...) Expand all
683 scoped_refptr<CallbackAndContext> callback_and_context = 681 scoped_refptr<CallbackAndContext> callback_and_context =
684 new CallbackAndContext(args.GetIsolate(), 682 new CallbackAndContext(args.GetIsolate(),
685 callback_local, 683 callback_local,
686 context.web_frame()->mainWorldScriptContext()); 684 context.web_frame()->mainWorldScriptContext());
687 685
688 686
689 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in 687 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in
690 // progress, we will leak the callback and context. This needs to be fixed, 688 // progress, we will leak the callback and context. This needs to be fixed,
691 // somehow. 689 // somehow.
692 context.render_view_impl()->QueueSyntheticGesture( 690 context.render_view_impl()->QueueSyntheticGesture(
693 gesture_params.PassAs<SyntheticGestureParams>(), 691 gesture_params.Pass(),
694 base::Bind(&OnSyntheticGestureCompleted, 692 base::Bind(&OnSyntheticGestureCompleted, callback_and_context));
695 callback_and_context));
696 693
697 args.GetReturnValue().Set(true); 694 args.GetReturnValue().Set(true);
698 } 695 }
699 696
700 static void BeginTap( 697 static void BeginTap(
701 const v8::FunctionCallbackInfo<v8::Value>& args) { 698 const v8::FunctionCallbackInfo<v8::Value>& args) {
702 GpuBenchmarkingContext context; 699 GpuBenchmarkingContext context;
703 if (!context.Init(false)) 700 if (!context.Init(false))
704 return; 701 return;
705 702
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 scoped_refptr<CallbackAndContext> callback_and_context = 738 scoped_refptr<CallbackAndContext> callback_and_context =
742 new CallbackAndContext(args.GetIsolate(), 739 new CallbackAndContext(args.GetIsolate(),
743 callback_local, 740 callback_local,
744 context.web_frame()->mainWorldScriptContext()); 741 context.web_frame()->mainWorldScriptContext());
745 742
746 743
747 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in 744 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in
748 // progress, we will leak the callback and context. This needs to be fixed, 745 // progress, we will leak the callback and context. This needs to be fixed,
749 // somehow. 746 // somehow.
750 context.render_view_impl()->QueueSyntheticGesture( 747 context.render_view_impl()->QueueSyntheticGesture(
751 gesture_params.PassAs<SyntheticGestureParams>(), 748 gesture_params.Pass(),
752 base::Bind(&OnSyntheticGestureCompleted, 749 base::Bind(&OnSyntheticGestureCompleted, callback_and_context));
753 callback_and_context));
754 750
755 args.GetReturnValue().Set(true); 751 args.GetReturnValue().Set(true);
756 } 752 }
757 753
758 static void OnSnapshotCompleted(CallbackAndContext* callback_and_context, 754 static void OnSnapshotCompleted(CallbackAndContext* callback_and_context,
759 const gfx::Size& size, 755 const gfx::Size& size,
760 const std::vector<unsigned char>& png) { 756 const std::vector<unsigned char>& png) {
761 v8::Isolate* isolate = callback_and_context->isolate(); 757 v8::Isolate* isolate = callback_and_context->isolate();
762 v8::HandleScope scope(isolate); 758 v8::HandleScope scope(isolate);
763 v8::Handle<v8::Context> context = callback_and_context->GetContext(); 759 v8::Handle<v8::Context> context = callback_and_context->GetContext();
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); 914 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel();
919 args.GetReturnValue().Set(!!gpu_channel); 915 args.GetReturnValue().Set(!!gpu_channel);
920 } 916 }
921 }; 917 };
922 918
923 v8::Extension* GpuBenchmarkingExtension::Get() { 919 v8::Extension* GpuBenchmarkingExtension::Get() {
924 return new GpuBenchmarkingWrapper(); 920 return new GpuBenchmarkingWrapper();
925 } 921 }
926 922
927 } // namespace content 923 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/frame_swap_message_queue_unittest.cc ('k') | content/renderer/java/gin_java_bridge_value_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698