Chromium Code Reviews| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 int distance_length = pixels_to_scroll * page_scale_factor; | 359 int distance_length = pixels_to_scroll * page_scale_factor; |
| 360 gfx::Vector2d distance; | 360 gfx::Vector2d distance; |
| 361 if (direction == "down") | 361 if (direction == "down") |
| 362 distance.set_y(-distance_length); | 362 distance.set_y(-distance_length); |
| 363 else if (direction == "up") | 363 else if (direction == "up") |
| 364 distance.set_y(distance_length); | 364 distance.set_y(distance_length); |
| 365 else if (direction == "right") | 365 else if (direction == "right") |
| 366 distance.set_x(-distance_length); | 366 distance.set_x(-distance_length); |
| 367 else if (direction == "left") | 367 else if (direction == "left") |
| 368 distance.set_x(distance_length); | 368 distance.set_x(distance_length); |
| 369 else if (direction == "upleft") { | |
| 370 distance.set_y(distance_length); | |
| 371 distance.set_x(distance_length); | |
| 372 } | |
| 373 else if (direction == "upright") { | |
|
jdduke (slow)
2015/02/26 01:05:35
Nit: else should start on the same line as the pre
cblume
2015/02/26 20:22:00
Oh, thank you. I've fixed this locally and will up
| |
| 374 distance.set_y(distance_length); | |
| 375 distance.set_x(-distance_length); | |
| 376 } | |
| 377 else if (direction == "downleft") { | |
| 378 distance.set_y(-distance_length); | |
| 379 distance.set_x(distance_length); | |
| 380 } | |
| 381 else if (direction == "downright") { | |
| 382 distance.set_y(-distance_length); | |
| 383 distance.set_x(-distance_length); | |
| 384 } | |
| 369 else { | 385 else { |
| 370 return false; | 386 return false; |
| 371 } | 387 } |
| 372 gesture_params->distances.push_back(distance); | 388 gesture_params->distances.push_back(distance); |
| 373 | 389 |
| 374 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in | 390 // TODO(nduca): If the render_view_impl is destroyed while the gesture is in |
| 375 // progress, we will leak the callback and context. This needs to be fixed, | 391 // progress, we will leak the callback and context. This needs to be fixed, |
| 376 // somehow. | 392 // somehow. |
| 377 context.render_view_impl()->QueueSyntheticGesture( | 393 context.render_view_impl()->QueueSyntheticGesture( |
| 378 gesture_params.Pass(), | 394 gesture_params.Pass(), |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 807 | 823 |
| 808 return context.compositor()->SendMessageToMicroBenchmark(id, value.Pass()); | 824 return context.compositor()->SendMessageToMicroBenchmark(id, value.Pass()); |
| 809 } | 825 } |
| 810 | 826 |
| 811 bool GpuBenchmarking::HasGpuProcess() { | 827 bool GpuBenchmarking::HasGpuProcess() { |
| 812 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 828 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
| 813 return !!gpu_channel; | 829 return !!gpu_channel; |
| 814 } | 830 } |
| 815 | 831 |
| 816 } // namespace content | 832 } // namespace content |
| OLD | NEW |