| 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/compositor_thread.h" | 5 #include "content/renderer/gpu/compositor_thread.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "content/renderer/gpu/input_event_filter.h" | 9 #include "content/renderer/gpu/input_event_filter.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebActiveWheelFlingPa
rameters.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebActiveWheelFlingPa
rameters.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 virtual void transferActiveWheelFlingAnimation( | 37 virtual void transferActiveWheelFlingAnimation( |
| 38 const WebKit::WebActiveWheelFlingParameters& params) { | 38 const WebKit::WebActiveWheelFlingParameters& params) { |
| 39 main_loop_->PostTask( | 39 main_loop_->PostTask( |
| 40 FROM_HERE, | 40 FROM_HERE, |
| 41 base::Bind(&RenderViewImpl::TransferActiveWheelFlingAnimation, | 41 base::Bind(&RenderViewImpl::TransferActiveWheelFlingAnimation, |
| 42 render_view_impl_, params)); | 42 render_view_impl_, params)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual ~InputHandlerWrapper() { | |
| 46 input_handler_->setClient(NULL); | |
| 47 } | |
| 48 | |
| 49 int routing_id() const { return routing_id_; } | 45 int routing_id() const { return routing_id_; } |
| 50 WebKit::WebCompositorInputHandler* input_handler() const { | 46 WebKit::WebCompositorInputHandler* input_handler() const { |
| 51 return input_handler_; | 47 return input_handler_; |
| 52 } | 48 } |
| 53 | 49 |
| 54 // WebCompositorInputHandlerClient methods: | 50 // WebCompositorInputHandlerClient methods: |
| 55 | 51 |
| 56 virtual void willShutdown() { | 52 virtual void willShutdown() { |
| 57 compositor_thread_->RemoveInputHandler(routing_id_); | 53 compositor_thread_->RemoveInputHandler(routing_id_); |
| 58 } | 54 } |
| 59 | 55 |
| 60 virtual void didHandleInputEvent() { | 56 virtual void didHandleInputEvent() { |
| 61 compositor_thread_->filter_->DidHandleInputEvent(); | 57 compositor_thread_->filter_->DidHandleInputEvent(); |
| 62 } | 58 } |
| 63 | 59 |
| 64 virtual void didNotHandleInputEvent(bool send_to_widget) { | 60 virtual void didNotHandleInputEvent(bool send_to_widget) { |
| 65 compositor_thread_->filter_->DidNotHandleInputEvent(send_to_widget); | 61 compositor_thread_->filter_->DidNotHandleInputEvent(send_to_widget); |
| 66 } | 62 } |
| 67 | 63 |
| 68 private: | 64 private: |
| 65 friend base::RefCountedThreadSafe<InputHandlerWrapper>; |
| 66 |
| 67 virtual ~InputHandlerWrapper() { |
| 68 input_handler_->setClient(NULL); |
| 69 } |
| 70 |
| 69 CompositorThread* compositor_thread_; | 71 CompositorThread* compositor_thread_; |
| 70 int routing_id_; | 72 int routing_id_; |
| 71 WebKit::WebCompositorInputHandler* input_handler_; | 73 WebKit::WebCompositorInputHandler* input_handler_; |
| 72 scoped_refptr<base::MessageLoopProxy> main_loop_; | 74 scoped_refptr<base::MessageLoopProxy> main_loop_; |
| 73 | 75 |
| 74 // Can only be accessed on the main thread. | 76 // Can only be accessed on the main thread. |
| 75 base::WeakPtr<RenderViewImpl> render_view_impl_; | 77 base::WeakPtr<RenderViewImpl> render_view_impl_; |
| 76 | 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(InputHandlerWrapper); | 79 DISALLOW_COPY_AND_ASSIGN(InputHandlerWrapper); |
| 78 }; | 80 }; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 InputHandlerMap::iterator it = input_handlers_.find(routing_id); | 156 InputHandlerMap::iterator it = input_handlers_.find(routing_id); |
| 155 if (it == input_handlers_.end()) { | 157 if (it == input_handlers_.end()) { |
| 156 TRACE_EVENT0("CompositorThread::HandleInputEvent", "NoInputHandlerFound"); | 158 TRACE_EVENT0("CompositorThread::HandleInputEvent", "NoInputHandlerFound"); |
| 157 // Oops, we no longer have an interested input handler.. | 159 // Oops, we no longer have an interested input handler.. |
| 158 filter_->DidNotHandleInputEvent(true); | 160 filter_->DidNotHandleInputEvent(true); |
| 159 return; | 161 return; |
| 160 } | 162 } |
| 161 | 163 |
| 162 it->second->input_handler()->handleInputEvent(*input_event); | 164 it->second->input_handler()->handleInputEvent(*input_event); |
| 163 } | 165 } |
| OLD | NEW |