| 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 static_cast<SyntheticGestureParams::GestureSourceType>( | 608 static_cast<SyntheticGestureParams::GestureSourceType>( |
| 609 gesture_source_type)); | 609 gesture_source_type)); |
| 610 } | 610 } |
| 611 | 611 |
| 612 bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) { | 612 bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) { |
| 613 GpuBenchmarkingContext context; | 613 GpuBenchmarkingContext context; |
| 614 if (!context.Init(true)) | 614 if (!context.Init(true)) |
| 615 return false; | 615 return false; |
| 616 | 616 |
| 617 float page_scale_factor = context.web_view()->pageScaleFactor(); | 617 float page_scale_factor = context.web_view()->pageScaleFactor(); |
| 618 blink::WebRect rect = context.render_view_impl()->GetWidget()->windowRect(); | 618 blink::WebRect rect = context.render_view_impl()->GetWidget()->viewRect(); |
| 619 | 619 |
| 620 float pixels_to_scroll = 0; | 620 float pixels_to_scroll = 0; |
| 621 v8::Local<v8::Function> callback; | 621 v8::Local<v8::Function> callback; |
| 622 float start_x = rect.width / (page_scale_factor * 2); | 622 float start_x = rect.width / (page_scale_factor * 2); |
| 623 float start_y = rect.height / (page_scale_factor * 2); | 623 float start_y = rect.height / (page_scale_factor * 2); |
| 624 int gesture_source_type = SyntheticGestureParams::DEFAULT_INPUT; | 624 int gesture_source_type = SyntheticGestureParams::DEFAULT_INPUT; |
| 625 std::string direction = "down"; | 625 std::string direction = "down"; |
| 626 float speed_in_pixels_s = 800; | 626 float speed_in_pixels_s = 800; |
| 627 | 627 |
| 628 if (!GetOptionalArg(args, &pixels_to_scroll) || | 628 if (!GetOptionalArg(args, &pixels_to_scroll) || |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 gesture_source_type, | 678 gesture_source_type, |
| 679 speed_in_pixels_s); | 679 speed_in_pixels_s); |
| 680 } | 680 } |
| 681 | 681 |
| 682 bool GpuBenchmarking::Swipe(gin::Arguments* args) { | 682 bool GpuBenchmarking::Swipe(gin::Arguments* args) { |
| 683 GpuBenchmarkingContext context; | 683 GpuBenchmarkingContext context; |
| 684 if (!context.Init(true)) | 684 if (!context.Init(true)) |
| 685 return false; | 685 return false; |
| 686 | 686 |
| 687 float page_scale_factor = context.web_view()->pageScaleFactor(); | 687 float page_scale_factor = context.web_view()->pageScaleFactor(); |
| 688 blink::WebRect rect = context.render_view_impl()->GetWidget()->windowRect(); | 688 blink::WebRect rect = context.render_view_impl()->GetWidget()->viewRect(); |
| 689 | 689 |
| 690 std::string direction = "up"; | 690 std::string direction = "up"; |
| 691 float pixels_to_scroll = 0; | 691 float pixels_to_scroll = 0; |
| 692 v8::Local<v8::Function> callback; | 692 v8::Local<v8::Function> callback; |
| 693 float start_x = rect.width / (page_scale_factor * 2); | 693 float start_x = rect.width / (page_scale_factor * 2); |
| 694 float start_y = rect.height / (page_scale_factor * 2); | 694 float start_y = rect.height / (page_scale_factor * 2); |
| 695 float speed_in_pixels_s = 800; | 695 float speed_in_pixels_s = 800; |
| 696 | 696 |
| 697 if (!GetOptionalArg(args, &direction) || | 697 if (!GetOptionalArg(args, &direction) || |
| 698 !GetOptionalArg(args, &pixels_to_scroll) || | 698 !GetOptionalArg(args, &pixels_to_scroll) || |
| (...skipping 14 matching lines...) Expand all Loading... |
| 713 start_x, | 713 start_x, |
| 714 start_y); | 714 start_y); |
| 715 } | 715 } |
| 716 | 716 |
| 717 bool GpuBenchmarking::ScrollBounce(gin::Arguments* args) { | 717 bool GpuBenchmarking::ScrollBounce(gin::Arguments* args) { |
| 718 GpuBenchmarkingContext context; | 718 GpuBenchmarkingContext context; |
| 719 if (!context.Init(false)) | 719 if (!context.Init(false)) |
| 720 return false; | 720 return false; |
| 721 | 721 |
| 722 float page_scale_factor = context.web_view()->pageScaleFactor(); | 722 float page_scale_factor = context.web_view()->pageScaleFactor(); |
| 723 blink::WebRect rect = context.render_view_impl()->GetWidget()->windowRect(); | 723 blink::WebRect rect = context.render_view_impl()->GetWidget()->viewRect(); |
| 724 | 724 |
| 725 std::string direction = "down"; | 725 std::string direction = "down"; |
| 726 float distance_length = 0; | 726 float distance_length = 0; |
| 727 float overscroll_length = 0; | 727 float overscroll_length = 0; |
| 728 int repeat_count = 1; | 728 int repeat_count = 1; |
| 729 v8::Local<v8::Function> callback; | 729 v8::Local<v8::Function> callback; |
| 730 float start_x = rect.width / (page_scale_factor * 2); | 730 float start_x = rect.width / (page_scale_factor * 2); |
| 731 float start_y = rect.height / (page_scale_factor * 2); | 731 float start_y = rect.height / (page_scale_factor * 2); |
| 732 float speed_in_pixels_s = 800; | 732 float speed_in_pixels_s = 800; |
| 733 | 733 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 &gpu_driver_bug_workarounds))) { | 1006 &gpu_driver_bug_workarounds))) { |
| 1007 return; | 1007 return; |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 v8::Local<v8::Value> result; | 1010 v8::Local<v8::Value> result; |
| 1011 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) | 1011 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) |
| 1012 args->Return(result); | 1012 args->Return(result); |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 } // namespace content | 1015 } // namespace content |
| OLD | NEW |