diff options
author | rjkroege@chromium.org <rjkroege@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-23 01:22:57 +0000 |
---|---|---|
committer | rjkroege@chromium.org <rjkroege@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-23 01:22:57 +0000 |
commit | 31274b795951e53cfe4075cdbe5eddc5681633ed (patch) | |
tree | f6ce169968eb3baed3401c45f4cc5fb147634465 /content | |
parent | d85b6eaf30882d6c104d932b9e876340478994be (diff) | |
download | chromium_src-31274b795951e53cfe4075cdbe5eddc5681633ed.zip chromium_src-31274b795951e53cfe4075cdbe5eddc5681633ed.tar.gz chromium_src-31274b795951e53cfe4075cdbe5eddc5681633ed.tar.bz2 |
Make GestureTapDown deferral delay be configurable.
Previous changes have added a deferral delay for the forwarding of
GestureTapDown events from the browser to the rendererer. Make this
value configurable from the command line for easier tuning.
BUG=137555
Review URL: https://chromiumcodereview.appspot.com/10824376
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152909 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/gesture_event_filter.cc | 35 | ||||
-rw-r--r-- | content/public/common/content_switches.cc | 4 | ||||
-rw-r--r-- | content/public/common/content_switches.h | 1 |
3 files changed, 37 insertions, 3 deletions
diff --git a/content/browser/renderer_host/gesture_event_filter.cc b/content/browser/renderer_host/gesture_event_filter.cc index ff725d4..f21691b 100644 --- a/content/browser/renderer_host/gesture_event_filter.cc +++ b/content/browser/renderer_host/gesture_event_filter.cc @@ -4,8 +4,11 @@ #include "content/browser/renderer_host/gesture_event_filter.h" +#include "base/command_line.h" +#include "base/string_number_conversions.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/tap_suppression_controller.h" +#include "content/public/common/content_switches.h" using WebKit::WebGestureEvent; using WebKit::WebInputEvent; @@ -15,8 +18,34 @@ namespace { // Default maximum time between the GestureRecognizer generating a // GestureTapDown and when it is forwarded to the renderer. -// TODO(rjkroege): Make this configurable. -static const int kMaxiumTapGapTimeMs = 100; +static const int kTapDownDeferralTimeMs = 100; + +// Sets |*value| to |switchKey| if it exists or sets it to |defaultValue|. +static void GetParamHelper(int* value, + int defaultValue, + const char switchKey[]) { + if (*value < 0) { + *value = defaultValue; + CommandLine* command_line = CommandLine::ForCurrentProcess(); + std::string command_line_param = + command_line->GetSwitchValueASCII(switchKey); + if (!command_line_param.empty()) { + int v; + if (base::StringToInt(command_line_param, &v)) + *value = v; + } + DCHECK_GE(*value, 0); + } +} + +static int GetTapDownDeferralTimeMs() { + static int tap_down_deferral_time_window = -1; + GetParamHelper(&tap_down_deferral_time_window, + kTapDownDeferralTimeMs, + switches::kTapDownDeferralTimeMs); + return tap_down_deferral_time_window; +} + // TODO(rjkroege): Coalesce pinch updates. // Returns |true| if two gesture events should be coalesced. @@ -32,7 +61,7 @@ GestureEventFilter::GestureEventFilter(RenderWidgetHostImpl* rwhv) : render_widget_host_(rwhv), fling_in_progress_(false), tap_suppression_controller_(new TapSuppressionController(rwhv)), - maximum_tap_gap_time_ms_(kMaxiumTapGapTimeMs) { + maximum_tap_gap_time_ms_(GetTapDownDeferralTimeMs()) { } GestureEventFilter::~GestureEventFilter() { } diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index e1accdc..2f32cd6 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -583,6 +583,10 @@ const char kSingleProcess[] = "single-process"; // content. The switch is intended only for tests. const char kSkipGpuDataLoading[] = "skip-gpu-data-loading"; +// GestureTapDown events are deferred by this many miillseconds before +// sending them to the renderer. +const char kTapDownDeferralTimeMs[] = "tap-down-deferral-time"; + // Runs the security test for the renderer sandbox. const char kTestSandbox[] = "test-sandbox"; diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 5a41c57..2056856 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -182,6 +182,7 @@ extern const char kShowPaintRects[]; CONTENT_EXPORT extern const char kSimulateTouchScreenWithMouse[]; CONTENT_EXPORT extern const char kSingleProcess[]; CONTENT_EXPORT extern const char kSkipGpuDataLoading[]; +extern const char kTapDownDeferralTimeMs[]; CONTENT_EXPORT extern const char kTestSandbox[]; extern const char kTraceStartup[]; extern const char kTraceStartupFile[]; |