diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-20 04:34:37 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-20 04:34:37 +0000 |
commit | 200a9c066a0e9f9d5f0b454ed259170496d95322 (patch) | |
tree | b5ad91244c258da307b6d85e1aac36c9e7b303cd /cc/test/fake_layer_tree_host_client.h | |
parent | ee28495a17a0f90788a8987ba25214eaa86c9245 (diff) | |
download | chromium_src-200a9c066a0e9f9d5f0b454ed259170496d95322.zip chromium_src-200a9c066a0e9f9d5f0b454ed259170496d95322.tar.gz chromium_src-200a9c066a0e9f9d5f0b454ed259170496d95322.tar.bz2 |
The moves the compositor thread's input event cracking logic in to content/ from Blink. This significantly decreases the amount of plumbing involved with setting up and tearing down the input filtering and makes it easier to extend without having to go through API rolls.
The startup sequence is as follows, all in the render process:
1.) [main thread] Compositor initialized in content::RenderWidgetCompositor::Create(). During initialization, cc::LayerTreeHost grabs a base::WeakPtr<cc::InputHandler> bounds to the compositor thread. The cc::InputHandler interface is implemented by cc::LayerTreeHostImpl.
2.) [main thread] RenderViewImpl::didActivateCompositor() grabs a WeakPtr to itself and a WeakPtr<cc::InputHandler> from the RenderWidgetCompositor and calls InputHandlerManager::AddInputHandler()
2.) [main thread] InputHandlerManager grabs a WeakPtr<> to its MessageLoopProxy posts a task to itself on the compositor thread to AddInputHandlerOnCompositorThread()
3.) [compositor thread] InputHandlerManager::AddInputHandlerOnCompositorThread() checks if the WeakPtr<cc::InputHandler> is still valid. If the WeakPtr has been invalidated or there's already an entry for this routing_id, it bails. Otherwise InputHandlerManager adds the new routing_id to the filter (which takes a lock on the [ipc thread]) and constructs a new InputHandlerWrapper and adds it to its input_handlers_ map
4.) [compositor thread] InputHandlerWrapper constructs a new InputHandlerClientImpl
5.) [compositor thread] InputHandlerProxy binds itself as the client for the cc::InputHandler
After this completes successfully, the cc::LayerTreeHostImpl has a weak (raw) pointer to the cc::InputHandlerClient, which is the content::InputHandlerProxy, and the InputHandlerProxy has a weak (raw) ptr to the cc::InputHandler, which is the cc::LayerTreeHostImpl. The flow for incoming IPCs is thus:
1.) [ipc thread] IPC message arrives and is dispatched at all IPC filters.
2.) [ipc thread] InputEventFilter::OnMessageReceived checks if the message is an InputMsg_ type. If so, it takes a lock on routes_ and checks if the IPC is intended for a routing_id with filtering. If so, it posts the message to the InputHandlerManager (via ForwardToHandler). If any of these checks fail, the filter rejects the message (returns false) and the IPC goes down the normal handling path which routes it to the main thread.
3.) [compositor thread] InputHandlerManager::HandleInputEvent() looks for an entry in its input_handlers_ map matching the message's routing_id. If there is one, it calls InputHandlerProxy::HandleInputEvent(). If there isn't, it sends the input event to the main thread.
4.) [compositor thread] InputHandlerProxy::HandleInputEvent() examines the fields on the input event and determines what set of logical scroll/pinch/whatnots should occur as a result of the event. To do this, it communicates with the compositor via the cc::InputHandler. After it has determined the disposition of the event, it returns a status to its embedder via the content::InputHandlerProxyClient interface (which is the content::InputHandlerWrapper).
5.) [compositor thread] content::InputHandlerWrapper forwards the event disposition back to the InputEventFilter, which can forward the message to the main thread or send an ACK as appropriate.
Shutdown:
1.) [compositor thread] ~cc::LayerTreeHostImpl() calls WillShutdown() its input_handler_client_, which is a content::InputHandlerProxy
2.) [compositor thread] content::InputHandlerProxy::WillShutdown() calls client_->WillShutdown()
3.) [compositor thread] content::InputHandlerWrapper::WillShutdown() calls input_handler_manager_->RemoveInputHandler() for its routing_id
4.) [compositor thread] content::InputHandlerManager::RemoveInputHandler() calls filters_->RemoveRoute(), which takes a lock on the InputEventFilter's routing table and removes the id, then erases the matching input_handlers_ entry which derefs the InputHandlerWrapper
After step 4 no more messages will be posted from the ipc thread to the compositor thread for the given routing id, but of course any number of tasks may already be posted. When these tasks run InputHandlerManager::HandleInputEvent() will find no matching entries in the input_handlers_ map and will send the messages back to the main thread.
BUG=236096
Review URL: https://chromiumcodereview.appspot.com/13844021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/fake_layer_tree_host_client.h')
-rw-r--r-- | cc/test/fake_layer_tree_host_client.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/cc/test/fake_layer_tree_host_client.h b/cc/test/fake_layer_tree_host_client.h index 5e029e7..47c4e27 100644 --- a/cc/test/fake_layer_tree_host_client.h +++ b/cc/test/fake_layer_tree_host_client.h @@ -33,7 +33,6 @@ class FakeLayerTreeHostClient : public LayerTreeHostClient { virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE; virtual void DidInitializeOutputSurface(bool success) OVERRIDE {} - virtual scoped_ptr<InputHandlerClient> CreateInputHandlerClient() OVERRIDE; virtual void WillCommit() OVERRIDE {} virtual void DidCommit() OVERRIDE {} virtual void DidCommitAndDrawFrame() OVERRIDE {} |