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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 int distance_length = pixels_to_scroll * page_scale_factor; | 360 int distance_length = pixels_to_scroll * page_scale_factor; |
361 gfx::Vector2d distance; | 361 gfx::Vector2d distance; |
362 if (direction == "down") | 362 if (direction == "down") |
363 distance.set_y(-distance_length); | 363 distance.set_y(-distance_length); |
364 else if (direction == "up") | 364 else if (direction == "up") |
365 distance.set_y(distance_length); | 365 distance.set_y(distance_length); |
366 else if (direction == "right") | 366 else if (direction == "right") |
367 distance.set_x(-distance_length); | 367 distance.set_x(-distance_length); |
368 else if (direction == "left") | 368 else if (direction == "left") |
369 distance.set_x(distance_length); | 369 distance.set_x(distance_length); |
370 else { | 370 else if (direction == "upleft") { |
| 371 distance.set_y(distance_length); |
| 372 distance.set_x(distance_length); |
| 373 } else if (direction == "upright") { |
| 374 distance.set_y(distance_length); |
| 375 distance.set_x(-distance_length); |
| 376 } else if (direction == "downleft") { |
| 377 distance.set_y(-distance_length); |
| 378 distance.set_x(distance_length); |
| 379 } else if (direction == "downright") { |
| 380 distance.set_y(-distance_length); |
| 381 distance.set_x(-distance_length); |
| 382 } else { |
371 return false; | 383 return false; |
372 } | 384 } |
373 gesture_params->distances.push_back(distance); | 385 gesture_params->distances.push_back(distance); |
374 | 386 |
375 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in | 387 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in |
376 // progress, we will leak the callback and context. This needs to be fixed, | 388 // progress, we will leak the callback and context. This needs to be fixed, |
377 // somehow. | 389 // somehow. |
378 context.render_view_impl()->QueueSyntheticGesture( | 390 context.render_view_impl()->QueueSyntheticGesture( |
379 gesture_params.Pass(), | 391 gesture_params.Pass(), |
380 base::Bind(&OnSyntheticGestureCompleted, callback_and_context)); | 392 base::Bind(&OnSyntheticGestureCompleted, callback_and_context)); |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 | 896 |
885 return context.compositor()->SendMessageToMicroBenchmark(id, value.Pass()); | 897 return context.compositor()->SendMessageToMicroBenchmark(id, value.Pass()); |
886 } | 898 } |
887 | 899 |
888 bool GpuBenchmarking::HasGpuProcess() { | 900 bool GpuBenchmarking::HasGpuProcess() { |
889 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 901 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
890 return !!gpu_channel; | 902 return !!gpu_channel; |
891 } | 903 } |
892 | 904 |
893 } // namespace content | 905 } // namespace content |
OLD | NEW |