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/base64.h" | 9 #include "base/base64.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 .SetMethod("gestureSourceTypeSupported", | 449 .SetMethod("gestureSourceTypeSupported", |
450 &GpuBenchmarking::GestureSourceTypeSupported) | 450 &GpuBenchmarking::GestureSourceTypeSupported) |
451 .SetMethod("smoothScrollBy", &GpuBenchmarking::SmoothScrollBy) | 451 .SetMethod("smoothScrollBy", &GpuBenchmarking::SmoothScrollBy) |
452 .SetMethod("smoothDrag", &GpuBenchmarking::SmoothDrag) | 452 .SetMethod("smoothDrag", &GpuBenchmarking::SmoothDrag) |
453 .SetMethod("swipe", &GpuBenchmarking::Swipe) | 453 .SetMethod("swipe", &GpuBenchmarking::Swipe) |
454 .SetMethod("scrollBounce", &GpuBenchmarking::ScrollBounce) | 454 .SetMethod("scrollBounce", &GpuBenchmarking::ScrollBounce) |
455 // TODO(dominikg): Remove once JS interface changes have rolled into | 455 // TODO(dominikg): Remove once JS interface changes have rolled into |
456 // stable. | 456 // stable. |
457 .SetValue("newPinchInterface", true) | 457 .SetValue("newPinchInterface", true) |
458 .SetMethod("pinchBy", &GpuBenchmarking::PinchBy) | 458 .SetMethod("pinchBy", &GpuBenchmarking::PinchBy) |
| 459 .SetMethod("visualViewportHeight", &GpuBenchmarking::VisualViewportHeight) |
| 460 .SetMethod("visualViewportWidth", &GpuBenchmarking::VisualViewportWidth) |
459 .SetMethod("tap", &GpuBenchmarking::Tap) | 461 .SetMethod("tap", &GpuBenchmarking::Tap) |
460 .SetMethod("clearImageCache", &GpuBenchmarking::ClearImageCache) | 462 .SetMethod("clearImageCache", &GpuBenchmarking::ClearImageCache) |
461 .SetMethod("runMicroBenchmark", &GpuBenchmarking::RunMicroBenchmark) | 463 .SetMethod("runMicroBenchmark", &GpuBenchmarking::RunMicroBenchmark) |
462 .SetMethod("sendMessageToMicroBenchmark", | 464 .SetMethod("sendMessageToMicroBenchmark", |
463 &GpuBenchmarking::SendMessageToMicroBenchmark) | 465 &GpuBenchmarking::SendMessageToMicroBenchmark) |
464 .SetMethod("hasGpuProcess", &GpuBenchmarking::HasGpuProcess); | 466 .SetMethod("hasGpuProcess", &GpuBenchmarking::HasGpuProcess); |
465 } | 467 } |
466 | 468 |
467 void GpuBenchmarking::SetNeedsDisplayOnAllLayers() { | 469 void GpuBenchmarking::SetNeedsDisplayOnAllLayers() { |
468 GpuBenchmarkingContext context; | 470 GpuBenchmarkingContext context; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in | 739 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in |
738 // progress, we will leak the callback and context. This needs to be fixed, | 740 // progress, we will leak the callback and context. This needs to be fixed, |
739 // somehow. | 741 // somehow. |
740 context.render_view_impl()->QueueSyntheticGesture( | 742 context.render_view_impl()->QueueSyntheticGesture( |
741 gesture_params.Pass(), | 743 gesture_params.Pass(), |
742 base::Bind(&OnSyntheticGestureCompleted, callback_and_context)); | 744 base::Bind(&OnSyntheticGestureCompleted, callback_and_context)); |
743 | 745 |
744 return true; | 746 return true; |
745 } | 747 } |
746 | 748 |
| 749 float GpuBenchmarking::VisualViewportHeight() { |
| 750 GpuBenchmarkingContext context; |
| 751 if (!context.Init(false)) |
| 752 return 0.0; |
| 753 return context.web_view()->visualViewportSize().height; |
| 754 } |
| 755 |
| 756 float GpuBenchmarking::VisualViewportWidth() { |
| 757 GpuBenchmarkingContext context; |
| 758 if (!context.Init(false)) |
| 759 return 0.0; |
| 760 return context.web_view()->visualViewportSize().width; |
| 761 } |
| 762 |
747 bool GpuBenchmarking::Tap(gin::Arguments* args) { | 763 bool GpuBenchmarking::Tap(gin::Arguments* args) { |
748 GpuBenchmarkingContext context; | 764 GpuBenchmarkingContext context; |
749 if (!context.Init(false)) | 765 if (!context.Init(false)) |
750 return false; | 766 return false; |
751 | 767 |
752 float position_x; | 768 float position_x; |
753 float position_y; | 769 float position_y; |
754 v8::Local<v8::Function> callback; | 770 v8::Local<v8::Function> callback; |
755 int duration_ms = 50; | 771 int duration_ms = 50; |
756 int gesture_source_type = SyntheticGestureParams::DEFAULT_INPUT; | 772 int gesture_source_type = SyntheticGestureParams::DEFAULT_INPUT; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 | 863 |
848 return context.compositor()->SendMessageToMicroBenchmark(id, value.Pass()); | 864 return context.compositor()->SendMessageToMicroBenchmark(id, value.Pass()); |
849 } | 865 } |
850 | 866 |
851 bool GpuBenchmarking::HasGpuProcess() { | 867 bool GpuBenchmarking::HasGpuProcess() { |
852 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 868 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
853 return !!gpu_channel; | 869 return !!gpu_channel; |
854 } | 870 } |
855 | 871 |
856 } // namespace content | 872 } // namespace content |
OLD | NEW |