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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 static_cast<SyntheticGestureParams::GestureSourceType>( | 617 static_cast<SyntheticGestureParams::GestureSourceType>( |
618 gesture_source_type)); | 618 gesture_source_type)); |
619 } | 619 } |
620 | 620 |
621 bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) { | 621 bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) { |
622 GpuBenchmarkingContext context; | 622 GpuBenchmarkingContext context; |
623 if (!context.Init(true)) | 623 if (!context.Init(true)) |
624 return false; | 624 return false; |
625 | 625 |
626 float page_scale_factor = context.web_view()->pageScaleFactor(); | 626 float page_scale_factor = context.web_view()->pageScaleFactor(); |
627 blink::WebRect rect = context.render_view_impl()->GetWidget()->windowRect(); | 627 blink::WebRect rect = context.render_view_impl()->GetWidget()->viewRect(); |
628 | 628 |
629 float pixels_to_scroll = 0; | 629 float pixels_to_scroll = 0; |
630 v8::Local<v8::Function> callback; | 630 v8::Local<v8::Function> callback; |
631 float start_x = rect.width / (page_scale_factor * 2); | 631 float start_x = rect.width / (page_scale_factor * 2); |
632 float start_y = rect.height / (page_scale_factor * 2); | 632 float start_y = rect.height / (page_scale_factor * 2); |
633 int gesture_source_type = SyntheticGestureParams::DEFAULT_INPUT; | 633 int gesture_source_type = SyntheticGestureParams::DEFAULT_INPUT; |
634 std::string direction = "down"; | 634 std::string direction = "down"; |
635 float speed_in_pixels_s = 800; | 635 float speed_in_pixels_s = 800; |
636 | 636 |
637 if (!GetOptionalArg(args, &pixels_to_scroll) || | 637 if (!GetOptionalArg(args, &pixels_to_scroll) || |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 gesture_source_type, | 687 gesture_source_type, |
688 speed_in_pixels_s); | 688 speed_in_pixels_s); |
689 } | 689 } |
690 | 690 |
691 bool GpuBenchmarking::Swipe(gin::Arguments* args) { | 691 bool GpuBenchmarking::Swipe(gin::Arguments* args) { |
692 GpuBenchmarkingContext context; | 692 GpuBenchmarkingContext context; |
693 if (!context.Init(true)) | 693 if (!context.Init(true)) |
694 return false; | 694 return false; |
695 | 695 |
696 float page_scale_factor = context.web_view()->pageScaleFactor(); | 696 float page_scale_factor = context.web_view()->pageScaleFactor(); |
697 blink::WebRect rect = context.render_view_impl()->GetWidget()->windowRect(); | 697 blink::WebRect rect = context.render_view_impl()->GetWidget()->viewRect(); |
698 | 698 |
699 std::string direction = "up"; | 699 std::string direction = "up"; |
700 float pixels_to_scroll = 0; | 700 float pixels_to_scroll = 0; |
701 v8::Local<v8::Function> callback; | 701 v8::Local<v8::Function> callback; |
702 float start_x = rect.width / (page_scale_factor * 2); | 702 float start_x = rect.width / (page_scale_factor * 2); |
703 float start_y = rect.height / (page_scale_factor * 2); | 703 float start_y = rect.height / (page_scale_factor * 2); |
704 float speed_in_pixels_s = 800; | 704 float speed_in_pixels_s = 800; |
705 | 705 |
706 if (!GetOptionalArg(args, &direction) || | 706 if (!GetOptionalArg(args, &direction) || |
707 !GetOptionalArg(args, &pixels_to_scroll) || | 707 !GetOptionalArg(args, &pixels_to_scroll) || |
(...skipping 14 matching lines...) Expand all Loading... |
722 start_x, | 722 start_x, |
723 start_y); | 723 start_y); |
724 } | 724 } |
725 | 725 |
726 bool GpuBenchmarking::ScrollBounce(gin::Arguments* args) { | 726 bool GpuBenchmarking::ScrollBounce(gin::Arguments* args) { |
727 GpuBenchmarkingContext context; | 727 GpuBenchmarkingContext context; |
728 if (!context.Init(false)) | 728 if (!context.Init(false)) |
729 return false; | 729 return false; |
730 | 730 |
731 float page_scale_factor = context.web_view()->pageScaleFactor(); | 731 float page_scale_factor = context.web_view()->pageScaleFactor(); |
732 blink::WebRect rect = context.render_view_impl()->GetWidget()->windowRect(); | 732 blink::WebRect rect = context.render_view_impl()->GetWidget()->viewRect(); |
733 | 733 |
734 std::string direction = "down"; | 734 std::string direction = "down"; |
735 float distance_length = 0; | 735 float distance_length = 0; |
736 float overscroll_length = 0; | 736 float overscroll_length = 0; |
737 int repeat_count = 1; | 737 int repeat_count = 1; |
738 v8::Local<v8::Function> callback; | 738 v8::Local<v8::Function> callback; |
739 float start_x = rect.width / (page_scale_factor * 2); | 739 float start_x = rect.width / (page_scale_factor * 2); |
740 float start_y = rect.height / (page_scale_factor * 2); | 740 float start_y = rect.height / (page_scale_factor * 2); |
741 float speed_in_pixels_s = 800; | 741 float speed_in_pixels_s = 800; |
742 | 742 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 &gpu_driver_bug_workarounds))) { | 1027 &gpu_driver_bug_workarounds))) { |
1028 return; | 1028 return; |
1029 } | 1029 } |
1030 | 1030 |
1031 v8::Local<v8::Value> result; | 1031 v8::Local<v8::Value> result; |
1032 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) | 1032 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) |
1033 args->Return(result); | 1033 args->Return(result); |
1034 } | 1034 } |
1035 | 1035 |
1036 } // namespace content | 1036 } // namespace content |
OLD | NEW |