summaryrefslogtreecommitdiffstats
path: root/components/html_viewer/html_frame_tree_manager.cc
diff options
context:
space:
mode:
authorsky <sky@chromium.org>2015-09-23 16:42:43 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-23 23:43:46 +0000
commit8ea749580e0a44f10d4c339517385e4aac528cb4 (patch)
tree56b7a4164ee6d11d13977c8cb9e691aabd5e172b /components/html_viewer/html_frame_tree_manager.cc
parent7e6758b018f1106be5860844d9b0be318db8d53a (diff)
downloadchromium_src-8ea749580e0a44f10d4c339517385e4aac528cb4.zip
chromium_src-8ea749580e0a44f10d4c339517385e4aac528cb4.tar.gz
chromium_src-8ea749580e0a44f10d4c339517385e4aac528cb4.tar.bz2
Fixes timing issue with frame creation
This patch gates OnConnect() until the client has responsed back from OnWillNavigate(). This is important for the case of the parent and client being in the same process. Consider the following. HTML Frame P creates a child, C, and navigates C to a new url C' and the loading status of C' changes. P creates C C navigates to C': C::OnWillNavigate() C'::OnConnect() C' updates loading state C'<server>::LoadingStateChanged P::OnFrameLoadingStateChanged() Problem is, this may be processed as: P creates C C navigates to C': C'::OnConnect() C' updates loading state C'<server>::LoadingStateChanged P::OnFrameLoadingStateChanged() C::OnWillNavigate() If this order results (which telemetry triggers), then when P gets OnFrameLoadingStateChanged it has C as still local and ignores the loading state change. By only calling OnConnect() after the client has hacked OnWillNavigate() we ensure the order as first outlined. BUG=none TEST=none R=yzshen@chromium.org Review URL: https://codereview.chromium.org/1362983003 Cr-Commit-Position: refs/heads/master@{#350392}
Diffstat (limited to 'components/html_viewer/html_frame_tree_manager.cc')
-rw-r--r--components/html_viewer/html_frame_tree_manager.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/html_viewer/html_frame_tree_manager.cc b/components/html_viewer/html_frame_tree_manager.cc
index e8b2de4..6d8d12e 100644
--- a/components/html_viewer/html_frame_tree_manager.cc
+++ b/components/html_viewer/html_frame_tree_manager.cc
@@ -94,6 +94,11 @@ HTMLFrame* HTMLFrameTreeManager::CreateFrameAndAttachToTree(
DCHECK(!frame_tree || change_id <= frame_tree->change_id_);
+ DVLOG(2) << "HTMLFrameTreeManager::CreateFrameAndAttachToTree "
+ << " frame_tree=" << frame_tree << " use_existing="
+ << (view_connect_type ==
+ web_view::mojom::VIEW_CONNECT_TYPE_USE_EXISTING)
+ << " frame_id=" << view_id;
if (view_connect_type == web_view::mojom::VIEW_CONNECT_TYPE_USE_EXISTING &&
!frame_tree) {
DVLOG(1) << "was told to use existing view but do not have frame tree";
@@ -300,6 +305,9 @@ void HTMLFrameTreeManager::ProcessOnFrameAdded(
if (pending_remove_ids_.count(frame_data->frame_id))
return;
+ DVLOG(2) << "OnFrameAdded this=" << this
+ << " frame_id=" << frame_data->frame_id;
+
HTMLFrame::CreateParams params(this, parent, frame_data->frame_id, nullptr,
frame_data->client_properties, nullptr);
// |parent| takes ownership of created HTMLFrame.
@@ -335,6 +343,8 @@ void HTMLFrameTreeManager::ProcessOnFrameRemoved(HTMLFrame* source,
if (frame->IsLocal())
return;
+ DVLOG(2) << "OnFrameRemoved this=" << this << " frame_id=" << frame_id;
+
DCHECK(!in_process_on_frame_removed_);
in_process_on_frame_removed_ = true;
base::WeakPtr<HTMLFrameTreeManager> ref(weak_factory_.GetWeakPtr());