Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: content/renderer/gpu/gpu_benchmarking_extension.cc

Issue 1157093002: Add smoothness test for hover during trackpad scrolling [perf implications] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pay attention to page_scale_factor. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/perf/page_sets/key_desktop_move_cases.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Convert coordinates from CSS pixels to density independent pixels (DIPs).
293 float page_scale_factor = context.web_view()->pageScaleFactor();
294
295 if (gesture_source_type == SyntheticGestureParams::MOUSE_INPUT) {
296 // Ensure the mouse is centered and visible, in case it will
297 // trigger any hover or mousemove effects.
298 blink::WebRect contentRect =
299 context.web_view()->mainFrame()->visibleContentRect();
300 blink::WebMouseEvent mouseMove;
301 mouseMove.type = blink::WebInputEvent::MouseMove;
302 mouseMove.x = (contentRect.x + contentRect.width / 2) * page_scale_factor;
303 mouseMove.y = (contentRect.y + contentRect.height / 2) * page_scale_factor;
304 context.web_view()->handleInputEvent(mouseMove);
305 context.web_view()->setCursorVisibilityState(true);
306 }
307
292 scoped_refptr<CallbackAndContext> callback_and_context = 308 scoped_refptr<CallbackAndContext> callback_and_context =
293 new CallbackAndContext( 309 new CallbackAndContext(
294 isolate, callback, context.web_frame()->mainWorldScriptContext()); 310 isolate, callback, context.web_frame()->mainWorldScriptContext());
295 311
296 scoped_ptr<SyntheticSmoothScrollGestureParams> gesture_params( 312 scoped_ptr<SyntheticSmoothScrollGestureParams> gesture_params(
297 new SyntheticSmoothScrollGestureParams); 313 new SyntheticSmoothScrollGestureParams);
298 314
299 // Convert coordinates from CSS pixels to density independent pixels (DIPs).
300 float page_scale_factor = context.web_view()->pageScaleFactor();
301
302 if (gesture_source_type < 0 || 315 if (gesture_source_type < 0 ||
303 gesture_source_type > SyntheticGestureParams::GESTURE_SOURCE_TYPE_MAX) { 316 gesture_source_type > SyntheticGestureParams::GESTURE_SOURCE_TYPE_MAX) {
304 return false; 317 return false;
305 } 318 }
306 gesture_params->gesture_source_type = 319 gesture_params->gesture_source_type =
307 static_cast<SyntheticGestureParams::GestureSourceType>( 320 static_cast<SyntheticGestureParams::GestureSourceType>(
308 gesture_source_type); 321 gesture_source_type);
309 322
310 gesture_params->speed_in_pixels_s = speed_in_pixels_s; 323 gesture_params->speed_in_pixels_s = speed_in_pixels_s;
311 gesture_params->prevent_fling = prevent_fling; 324 gesture_params->prevent_fling = prevent_fling;
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | tools/perf/page_sets/key_desktop_move_cases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698