diff options
author | jdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 07:54:04 +0000 |
---|---|---|
committer | jdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 07:54:04 +0000 |
commit | 6ac2fff8affd182c3107b540f511cad5e86ea883 (patch) | |
tree | 1087d2856a6ace45b670c340142ae440cd8c1a34 | |
parent | 4f052b310b14041c70425c31c03b8404d3356154 (diff) | |
download | chromium_src-6ac2fff8affd182c3107b540f511cad5e86ea883.zip chromium_src-6ac2fff8affd182c3107b540f511cad5e86ea883.tar.gz chromium_src-6ac2fff8affd182c3107b540f511cad5e86ea883.tar.bz2 |
Stop refcounting InputHandlerWrapper
InputHandlerWrapper has strong ownership semantics, and no longer requires
ref-counting for safe shutdown. Remove its ref-counted property, updating
InputHandlerManager to accomodate the change.
Review URL: https://codereview.chromium.org/106493005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239707 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/renderer/gpu/input_handler_manager.cc | 9 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_manager.h | 7 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_wrapper.cc | 1 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_wrapper.h | 10 |
4 files changed, 11 insertions, 16 deletions
diff --git a/content/renderer/gpu/input_handler_manager.cc b/content/renderer/gpu/input_handler_manager.cc index a5adaf0..bf04859 100644 --- a/content/renderer/gpu/input_handler_manager.cc +++ b/content/renderer/gpu/input_handler_manager.cc @@ -88,13 +88,14 @@ void InputHandlerManager::AddInputHandlerOnCompositorThread( "InputHandlerManager::AddInputHandlerOnCompositorThread", "result", "AddingRoute"); client_->DidAddInputHandler(routing_id, input_handler.get()); - input_handlers_[routing_id] = - make_scoped_refptr(new InputHandlerWrapper(this, - routing_id, main_loop, input_handler, render_view_impl)); + input_handlers_.add(routing_id, + make_scoped_ptr(new InputHandlerWrapper(this, + routing_id, main_loop, input_handler, render_view_impl))); } void InputHandlerManager::RemoveInputHandler(int routing_id) { DCHECK(message_loop_proxy_->BelongsToCurrentThread()); + DCHECK(input_handlers_.contains(routing_id)); TRACE_EVENT0("input", "InputHandlerManager::RemoveInputHandler"); @@ -111,7 +112,7 @@ InputEventAckState InputHandlerManager::HandleInputEvent( InputHandlerMap::iterator it = input_handlers_.find(routing_id); if (it == input_handlers_.end()) { TRACE_EVENT1("input", "InputHandlerManager::HandleInputEvent", - "result", "NoInputHandlerFound"); + "result", "NoInputHandlerFound"); // Oops, we no longer have an interested input handler.. return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; } diff --git a/content/renderer/gpu/input_handler_manager.h b/content/renderer/gpu/input_handler_manager.h index 0249744..624fb27 100644 --- a/content/renderer/gpu/input_handler_manager.h +++ b/content/renderer/gpu/input_handler_manager.h @@ -5,8 +5,7 @@ #ifndef CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ #define CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ -#include <map> - +#include "base/containers/scoped_ptr_hash_map.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "content/port/common/input_event_ack_state.h" @@ -66,8 +65,8 @@ class InputHandlerManager { const base::WeakPtr<cc::InputHandler>& input_handler, const base::WeakPtr<RenderViewImpl>& render_view_impl); - typedef std::map<int, // routing_id - scoped_refptr<InputHandlerWrapper> > InputHandlerMap; + typedef base::ScopedPtrHashMap<int, // routing_id + InputHandlerWrapper> InputHandlerMap; InputHandlerMap input_handlers_; scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; diff --git a/content/renderer/gpu/input_handler_wrapper.cc b/content/renderer/gpu/input_handler_wrapper.cc index d1747f2..502819b 100644 --- a/content/renderer/gpu/input_handler_wrapper.cc +++ b/content/renderer/gpu/input_handler_wrapper.cc @@ -22,6 +22,7 @@ InputHandlerWrapper::InputHandlerWrapper( input_handler_proxy_(input_handler.get()), main_loop_(main_loop), render_view_impl_(render_view_impl) { + DCHECK(input_handler); input_handler_proxy_.SetClient(this); } diff --git a/content/renderer/gpu/input_handler_wrapper.h b/content/renderer/gpu/input_handler_wrapper.h index 9a5ba0c..0511403 100644 --- a/content/renderer/gpu/input_handler_wrapper.h +++ b/content/renderer/gpu/input_handler_wrapper.h @@ -5,7 +5,6 @@ #ifndef CONTENT_RENDERER_GPU_INPUT_HANDLER_WRAPPER_H_ #define CONTENT_RENDERER_GPU_INPUT_HANDLER_WRAPPER_H_ -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "content/renderer/gpu/input_handler_manager.h" #include "content/renderer/gpu/input_handler_proxy.h" @@ -14,15 +13,14 @@ namespace content { // This class lives on the compositor thread. -class InputHandlerWrapper - : public InputHandlerProxyClient, - public base::RefCountedThreadSafe<InputHandlerWrapper> { +class InputHandlerWrapper : public InputHandlerProxyClient { public: InputHandlerWrapper(InputHandlerManager* input_handler_manager, int routing_id, const scoped_refptr<base::MessageLoopProxy>& main_loop, const base::WeakPtr<cc::InputHandler>& input_handler, const base::WeakPtr<RenderViewImpl>& render_view_impl); + virtual ~InputHandlerWrapper(); int routing_id() const { return routing_id_; } InputHandlerProxy* input_handler_proxy() { return &input_handler_proxy_; } @@ -38,10 +36,6 @@ class InputHandlerWrapper virtual void DidOverscroll(const cc::DidOverscrollParams& params) OVERRIDE; private: - friend class base::RefCountedThreadSafe<InputHandlerWrapper>; - - virtual ~InputHandlerWrapper(); - InputHandlerManager* input_handler_manager_; int routing_id_; InputHandlerProxy input_handler_proxy_; |