diff options
author | khushalsagar <khushalsagar@chromium.org> | 2016-02-22 16:23:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-23 00:25:32 +0000 |
commit | 6b649b906eefc6bbc4e1d68a40d0c758c6b45d33 (patch) | |
tree | f908d00a89d5f2ed283c3140f0bf956ed145fd6c /blimp/engine/session | |
parent | 72be257ccfaca7dcd2f48db66b0c2191607b6bfc (diff) | |
download | chromium_src-6b649b906eefc6bbc4e1d68a40d0c758c6b45d33.zip chromium_src-6b649b906eefc6bbc4e1d68a40d0c758c6b45d33.tar.gz chromium_src-6b649b906eefc6bbc4e1d68a40d0c758c6b45d33.tar.bz2 |
Blimp: Add support for multiple render widget compositors on the client.
The BlimpEngineSession currently listens to OnRenderWidgetInitialized
events from WebContents to tie the compositor and input feature channels
to the current compositor. Any compositor messages for a pending render
widget are dropped on the engine.
This means that in case of a cross-site navigation, the compositor
messages sent from the render widget for the navigation are dropped
before it in initialized. Since the compositor protocol expects in-order
reliable delivery of messages, it causes these navigations to fail.
The BlimpEngineSession will now listen to RenderViewCreated and
RenderViewDeleted events from WebContents to create and destroy a
corresponding BlimpCompositor instance on the client. The lifetime of the
BlimpCompositor is tied to the lifetime of the RenderWidget. When a
RenderWidget is initialized, the client is informed to bind the compositor
instance for this widget to the native view.
Review URL: https://codereview.chromium.org/1705163002
Cr-Commit-Position: refs/heads/master@{#376864}
Diffstat (limited to 'blimp/engine/session')
-rw-r--r-- | blimp/engine/session/blimp_engine_session.cc | 43 | ||||
-rw-r--r-- | blimp/engine/session/blimp_engine_session.h | 10 |
2 files changed, 29 insertions, 24 deletions
diff --git a/blimp/engine/session/blimp_engine_session.cc b/blimp/engine/session/blimp_engine_session.cc index be176df..386902f 100644 --- a/blimp/engine/session/blimp_engine_session.cc +++ b/blimp/engine/session/blimp_engine_session.cc @@ -332,33 +332,17 @@ void BlimpEngineSession::Reload(const int target_tab_id) { } void BlimpEngineSession::OnWebGestureEvent( + content::RenderWidgetHost* render_widget_host, scoped_ptr<blink::WebGestureEvent> event) { - if (!web_contents_ || !web_contents_->GetRenderViewHost()) - return; - - content::RenderWidgetHost* host = - web_contents_->GetRenderViewHost()->GetWidget(); - - if (!host) - return; - host->ForwardGestureEvent(*event); + render_widget_host->ForwardGestureEvent(*event); } void BlimpEngineSession::OnCompositorMessageReceived( + content::RenderWidgetHost* render_widget_host, const std::vector<uint8_t>& message) { - // Make sure that We actually have a valid WebContents and RenderViewHost. - if (!web_contents_ || !web_contents_->GetRenderViewHost()) - return; - - content::RenderWidgetHost* host = - web_contents_->GetRenderViewHost()->GetWidget(); - // Make sure we actually have a valid RenderWidgetHost. - if (!host) - return; - - host->HandleCompositorProto(message); + render_widget_host->HandleCompositorProto(message); } void BlimpEngineSession::ProcessMessage( @@ -464,8 +448,10 @@ void BlimpEngineSession::ActivateContents(content::WebContents* contents) { } void BlimpEngineSession::ForwardCompositorProto( + content::RenderWidgetHost* render_widget_host, const std::vector<uint8_t>& proto) { - render_widget_feature_.SendCompositorMessage(kDummyTabId, proto); + render_widget_feature_.SendCompositorMessage(kDummyTabId, render_widget_host, + proto); } void BlimpEngineSession::NavigationStateChanged( @@ -499,12 +485,25 @@ void BlimpEngineSession::NavigationStateChanged( net::CompletionCallback()); } +void BlimpEngineSession::RenderViewCreated( + content::RenderViewHost* render_view_host) { + render_widget_feature_.OnRenderWidgetCreated(kDummyTabId, + render_view_host->GetWidget()); +} + void BlimpEngineSession::RenderViewHostChanged( content::RenderViewHost* old_host, content::RenderViewHost* new_host) { // Informs client that WebContents swaps its visible RenderViewHost with // another one. - render_widget_feature_.OnRenderWidgetInitialized(kDummyTabId); + render_widget_feature_.OnRenderWidgetInitialized(kDummyTabId, + new_host->GetWidget()); +} + +void BlimpEngineSession::RenderViewDeleted( + content::RenderViewHost* render_view_host) { + render_widget_feature_.OnRenderWidgetDeleted(kDummyTabId, + render_view_host->GetWidget()); } void BlimpEngineSession::PlatformSetContents( diff --git a/blimp/engine/session/blimp_engine_session.h b/blimp/engine/session/blimp_engine_session.h index e6b4b32..058932e 100644 --- a/blimp/engine/session/blimp_engine_session.h +++ b/blimp/engine/session/blimp_engine_session.h @@ -112,8 +112,10 @@ class BlimpEngineSession // RenderWidgetMessage handler methods. // RenderWidgetMessageDelegate implementation. - void OnWebGestureEvent(scoped_ptr<blink::WebGestureEvent> event) override; + void OnWebGestureEvent(content::RenderWidgetHost* render_widget_host, + scoped_ptr<blink::WebGestureEvent> event) override; void OnCompositorMessageReceived( + content::RenderWidgetHost* render_widget_host, const std::vector<uint8_t>& message) override; // content::WebContentsDelegate implementation. @@ -131,13 +133,17 @@ class BlimpEngineSession bool last_unlocked_by_target) override; void CloseContents(content::WebContents* source) override; void ActivateContents(content::WebContents* contents) override; - void ForwardCompositorProto(const std::vector<uint8_t>& proto) override; + void ForwardCompositorProto( + content::RenderWidgetHost* render_widget_host, + const std::vector<uint8_t>& proto) override; void NavigationStateChanged(content::WebContents* source, content::InvalidateTypes changed_flags) override; // content::WebContentsObserver implementation. + void RenderViewCreated(content::RenderViewHost* render_view_host) override; void RenderViewHostChanged(content::RenderViewHost* old_host, content::RenderViewHost* new_host) override; + void RenderViewDeleted(content::RenderViewHost* render_view_host) override; // Sets up and owns |new_contents|. void PlatformSetContents(scoped_ptr<content::WebContents> new_contents); |