From 1f89c007ba4f55f8b386a49d9824029e6bca963b Mon Sep 17 00:00:00 2001 From: ccameron Date: Mon, 20 Oct 2014 23:19:05 -0700 Subject: [PATCH] Add a flag to enable impl-thread event handling on Mac This feature is in active development. BUG=224781 Review URL: https://codereview.chromium.org/671533003 Cr-Commit-Position: refs/heads/master@{#300427} --- .../renderer_host/render_process_host_impl.cc | 3 +++ content/public/common/content_switches.cc | 7 +++++- content/public/common/content_switches.h | 1 + content/renderer/render_view_impl.cc | 25 ++++++++++++++-------- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index ff3f2b7a82c5..c8dd34bf73c1 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -1238,6 +1238,9 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( // Allow this to be set when invoking the browser and relayed along. switches::kEnableSandboxLogging, #endif +#if defined(OS_MACOSX) && !defined(OS_IOS) + switches::kEnableThreadedEventHandlingMac, +#endif #if defined(OS_WIN) switches::kDisableDirectWrite, #endif diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 791cc70e29e8..1b95179dbd86 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -940,9 +940,14 @@ const char kEnableSpeechDispatcher[] = "enable-speech-dispatcher"; #if defined(OS_MACOSX) && !defined(OS_IOS) // Disables support for Core Animation plugins. This is triggered when -// accelerated compositing is disabled. See http://crbug.com/122430 . +// accelerated compositing is disabled. See http://crbug.com/122430. const char kDisableCoreAnimationPlugins[] = "disable-core-animation-plugins"; + +// Allows input events to be handed on the compositor thread. +// This feature is under development, see http://crbug.com/138003. +extern const char kEnableThreadedEventHandlingMac[] = + "enable-threaded-event-handling-mac"; #endif #if defined(OS_WIN) diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 9da3c1d4a69f..9ff824535018 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -276,6 +276,7 @@ CONTENT_EXPORT extern const char kEnableSpeechDispatcher[]; #if defined(OS_MACOSX) && !defined(OS_IOS) extern const char kDisableCoreAnimationPlugins[]; +extern const char kEnableThreadedEventHandlingMac[]; #endif #if defined(OS_WIN) diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index d5ace2b06327..04edbd02faf3 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -2134,16 +2134,23 @@ void RenderViewImpl::initializeLayerTreeView() { if (webview() && webview()->devToolsAgent()) webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); -#if !defined(OS_MACOSX) // many events are unhandled - http://crbug.com/138003 - RenderThreadImpl* render_thread = RenderThreadImpl::current(); - // render_thread may be NULL in tests. - InputHandlerManager* input_handler_manager = - render_thread ? render_thread->input_handler_manager() : NULL; - if (input_handler_manager) { - input_handler_manager->AddInputHandler( - routing_id_, rwc->GetInputHandler(), AsWeakPtr()); - } + bool use_threaded_event_handling = true; +#if defined(OS_MACOSX) && !defined(OS_IOS) + // Development flag because many events are still unhandled on Mac. + // http://crbug.com/138003 + use_threaded_event_handling = CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableThreadedEventHandlingMac); #endif + if (use_threaded_event_handling) { + RenderThreadImpl* render_thread = RenderThreadImpl::current(); + // render_thread may be NULL in tests. + InputHandlerManager* input_handler_manager = + render_thread ? render_thread->input_handler_manager() : NULL; + if (input_handler_manager) { + input_handler_manager->AddInputHandler( + routing_id_, rwc->GetInputHandler(), AsWeakPtr()); + } + } } // blink::WebFrameClient ----------------------------------------------------- -- 2.11.4.GIT