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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 int gesture_source_type, | 282 int gesture_source_type, |
283 const std::string& direction, | 283 const std::string& direction, |
284 float speed_in_pixels_s, | 284 float speed_in_pixels_s, |
285 bool prevent_fling, | 285 bool prevent_fling, |
286 float start_x, | 286 float start_x, |
287 float start_y) { | 287 float start_y) { |
288 GpuBenchmarkingContext context; | 288 GpuBenchmarkingContext context; |
289 if (!context.Init(false)) | 289 if (!context.Init(false)) |
290 return false; | 290 return false; |
291 | 291 |
| 292 if (gesture_source_type == SyntheticGestureParams::MOUSE_INPUT) { |
| 293 // Ensure the mouse is centered and visible, in case it will |
| 294 // trigger any hover or mousemove effects. |
| 295 blink::WebRect contentRect = |
| 296 context.web_view()->mainFrame()->visibleContentRect(); |
| 297 blink::WebMouseEvent mouseMove; |
| 298 mouseMove.type = blink::WebInputEvent::MouseMove; |
| 299 mouseMove.x = contentRect.x + contentRect.width / 2; |
| 300 mouseMove.y = contentRect.y + contentRect.height / 2; |
| 301 context.web_view()->handleInputEvent(mouseMove); |
| 302 context.web_view()->setCursorVisibilityState(true); |
| 303 } |
| 304 |
292 scoped_refptr<CallbackAndContext> callback_and_context = | 305 scoped_refptr<CallbackAndContext> callback_and_context = |
293 new CallbackAndContext( | 306 new CallbackAndContext( |
294 isolate, callback, context.web_frame()->mainWorldScriptContext()); | 307 isolate, callback, context.web_frame()->mainWorldScriptContext()); |
295 | 308 |
296 scoped_ptr<SyntheticSmoothScrollGestureParams> gesture_params( | 309 scoped_ptr<SyntheticSmoothScrollGestureParams> gesture_params( |
297 new SyntheticSmoothScrollGestureParams); | 310 new SyntheticSmoothScrollGestureParams); |
298 | 311 |
299 // Convert coordinates from CSS pixels to density independent pixels (DIPs). | 312 // Convert coordinates from CSS pixels to density independent pixels (DIPs). |
300 float page_scale_factor = context.web_view()->pageScaleFactor(); | 313 float page_scale_factor = context.web_view()->pageScaleFactor(); |
301 | 314 |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 | 847 |
835 return context.compositor()->SendMessageToMicroBenchmark(id, value.Pass()); | 848 return context.compositor()->SendMessageToMicroBenchmark(id, value.Pass()); |
836 } | 849 } |
837 | 850 |
838 bool GpuBenchmarking::HasGpuProcess() { | 851 bool GpuBenchmarking::HasGpuProcess() { |
839 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 852 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
840 return !!gpu_channel; | 853 return !!gpu_channel; |
841 } | 854 } |
842 | 855 |
843 } // namespace content | 856 } // namespace content |
OLD | NEW |