Chromium Code Reviews| Index: content/renderer/gpu/input_handler_manager.cc |
| diff --git a/content/renderer/gpu/input_handler_manager.cc b/content/renderer/gpu/input_handler_manager.cc |
| index 246c86652401aaf2be01f278dd4a0b804d8a2eb5..6c49c5846294e6740d11b5d66bb11aa0659d548e 100644 |
| --- a/content/renderer/gpu/input_handler_manager.cc |
| +++ b/content/renderer/gpu/input_handler_manager.cc |
| @@ -6,10 +6,13 @@ |
| #include "base/bind.h" |
| #include "base/debug/trace_event.h" |
| +#include "cc/input/input_handler.h" |
| #include "content/renderer/gpu/input_event_filter.h" |
| +#include "content/renderer/gpu/input_handler_wrapper.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebActiveWheelFlingParameters.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositorInputHandler.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h" |
| +#include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" |
|
danakj
2013/05/01 19:20:43
Needed?
|
| #if defined(OS_ANDROID) |
| // TODO(epenner): Move thread priorities to base. (crbug.com/170549) |
| @@ -21,72 +24,6 @@ using WebKit::WebInputEvent; |
| namespace content { |
| -//------------------------------------------------------------------------------ |
| - |
| -class InputHandlerManager::InputHandlerWrapper |
| - : public WebKit::WebCompositorInputHandlerClient, |
| - public base::RefCountedThreadSafe<InputHandlerWrapper> { |
| - public: |
| - InputHandlerWrapper(InputHandlerManager* input_handler_manager, |
| - int routing_id, |
| - WebKit::WebCompositorInputHandler* input_handler, |
| - const scoped_refptr<base::MessageLoopProxy>& main_loop, |
| - const base::WeakPtr<RenderViewImpl>& render_view_impl) |
| - : input_handler_manager_(input_handler_manager), |
| - routing_id_(routing_id), |
| - input_handler_(input_handler), |
| - main_loop_(main_loop), |
| - render_view_impl_(render_view_impl) { |
| - input_handler_->setClient(this); |
| - } |
| - |
| - virtual void transferActiveWheelFlingAnimation( |
| - const WebKit::WebActiveWheelFlingParameters& params) { |
| - main_loop_->PostTask( |
| - FROM_HERE, |
| - base::Bind(&RenderViewImpl::TransferActiveWheelFlingAnimation, |
| - render_view_impl_, params)); |
| - } |
| - |
| - int routing_id() const { return routing_id_; } |
| - WebKit::WebCompositorInputHandler* input_handler() const { |
| - return input_handler_; |
| - } |
| - |
| - // WebCompositorInputHandlerClient methods: |
| - |
| - virtual void willShutdown() { |
| - input_handler_manager_->RemoveInputHandler(routing_id_); |
| - } |
| - |
| - virtual void didHandleInputEvent() { |
| - input_handler_manager_->filter_->DidHandleInputEvent(); |
| - } |
| - |
| - virtual void didNotHandleInputEvent(bool send_to_widget) { |
| - input_handler_manager_->filter_->DidNotHandleInputEvent(send_to_widget); |
| - } |
| - |
| - private: |
| - friend class base::RefCountedThreadSafe<InputHandlerWrapper>; |
| - |
| - virtual ~InputHandlerWrapper() { |
| - input_handler_->setClient(NULL); |
| - } |
| - |
| - InputHandlerManager* input_handler_manager_; |
| - int routing_id_; |
| - WebKit::WebCompositorInputHandler* input_handler_; |
| - scoped_refptr<base::MessageLoopProxy> main_loop_; |
| - |
| - // Can only be accessed on the main thread. |
| - base::WeakPtr<RenderViewImpl> render_view_impl_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(InputHandlerWrapper); |
| -}; |
| - |
| -//------------------------------------------------------------------------------ |
| - |
| #if defined(OS_ANDROID) |
| // TODO(epenner): Move thread priorities to base. (crbug.com/170549) |
| namespace { |
| @@ -121,7 +58,8 @@ InputHandlerManager::GetMessageFilter() const { |
| } |
| void InputHandlerManager::AddInputHandler( |
| - int routing_id, int input_handler_id, |
| + int routing_id, |
| + const base::WeakPtr<cc::InputHandler>& input_handler, |
| const base::WeakPtr<RenderViewImpl>& render_view_impl) { |
| DCHECK(!message_loop_proxy_->BelongsToCurrentThread()); |
| @@ -130,19 +68,19 @@ void InputHandlerManager::AddInputHandler( |
| base::Bind(&InputHandlerManager::AddInputHandlerOnCompositorThread, |
| base::Unretained(this), |
| routing_id, |
| - input_handler_id, |
| base::MessageLoopProxy::current(), |
| + input_handler, |
| render_view_impl)); |
| } |
| void InputHandlerManager::AddInputHandlerOnCompositorThread( |
| - int routing_id, int input_handler_id, |
| + int routing_id, |
| const scoped_refptr<base::MessageLoopProxy>& main_loop, |
| + const base::WeakPtr<cc::InputHandler>& input_handler, |
| const base::WeakPtr<RenderViewImpl>& render_view_impl) { |
| DCHECK(message_loop_proxy_->BelongsToCurrentThread()); |
| - WebCompositorInputHandler* input_handler = |
| - WebCompositorInputHandler::fromIdentifier(input_handler_id); |
| + // The handler could be gone by this point if the compositor has shut down. |
| if (!input_handler) |
| return; |
| @@ -150,7 +88,7 @@ void InputHandlerManager::AddInputHandlerOnCompositorThread( |
| // It's valid to call AddInputHandler() for the same routing id with the |
| // same input_handler many times, but it's not valid to change the |
| // input_handler for a route. |
| - DCHECK_EQ(input_handlers_[routing_id]->input_handler(), input_handler); |
| + //DCHECK_EQ(input_handlers_[routing_id]->input_handler(), input_handler); |
|
danakj
2013/05/01 19:20:43
?
|
| return; |
| } |
| @@ -158,7 +96,7 @@ void InputHandlerManager::AddInputHandlerOnCompositorThread( |
| filter_->AddRoute(routing_id); |
| input_handlers_[routing_id] = |
| make_scoped_refptr(new InputHandlerWrapper(this, |
| - routing_id, input_handler, main_loop, render_view_impl)); |
| + routing_id, main_loop, input_handler, render_view_impl)); |
| } |
| void InputHandlerManager::RemoveInputHandler(int routing_id) { |
| @@ -184,7 +122,7 @@ void InputHandlerManager::HandleInputEvent( |
| return; |
| } |
| - it->second->input_handler()->handleInputEvent(*input_event); |
| + it->second->input_handler()->HandleInputEvent(*input_event); |
|
danakj
2013/05/01 19:39:04
This will be null deref once the LTHI is gone righ
|
| } |
| } // namespace content |