Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 if (!GetParent()) | 1131 if (!GetParent()) |
| 1132 delegate_->SwappedOut(this); | 1132 delegate_->SwappedOut(this); |
| 1133 } | 1133 } |
| 1134 | 1134 |
| 1135 void RenderFrameHostImpl::OnBeforeUnloadACK( | 1135 void RenderFrameHostImpl::OnBeforeUnloadACK( |
| 1136 bool proceed, | 1136 bool proceed, |
| 1137 const base::TimeTicks& renderer_before_unload_start_time, | 1137 const base::TimeTicks& renderer_before_unload_start_time, |
| 1138 const base::TimeTicks& renderer_before_unload_end_time) { | 1138 const base::TimeTicks& renderer_before_unload_end_time) { |
| 1139 TRACE_EVENT_ASYNC_END0( | 1139 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this, |
|
clamy
2015/12/18 15:42:11
Is it an issue if this is called without the begin
carlosk
2015/12/18 17:23:21
From a tracing perspective no. I have to rely on t
| |
| 1140 "navigation", "RenderFrameHostImpl::BeforeUnload", this); | 1140 "FrameTreeNode id", |
| 1141 frame_tree_node_->frame_tree_node_id()); | |
| 1141 DCHECK(!GetParent()); | 1142 DCHECK(!GetParent()); |
| 1142 // If this renderer navigated while the beforeunload request was in flight, we | 1143 // If this renderer navigated while the beforeunload request was in flight, we |
| 1143 // may have cleared this state in OnDidCommitProvisionalLoad, in which case we | 1144 // may have cleared this state in OnDidCommitProvisionalLoad, in which case we |
| 1144 // can ignore this message. | 1145 // can ignore this message. |
| 1145 // However renderer might also be swapped out but we still want to proceed | 1146 // However renderer might also be swapped out but we still want to proceed |
| 1146 // with navigation, otherwise it would block future navigations. This can | 1147 // with navigation, otherwise it would block future navigations. This can |
| 1147 // happen when pending cross-site navigation is canceled by a second one just | 1148 // happen when pending cross-site navigation is canceled by a second one just |
| 1148 // before OnDidCommitProvisionalLoad while current RVH is waiting for commit | 1149 // before OnDidCommitProvisionalLoad while current RVH is waiting for commit |
| 1149 // but second navigation is started from the beginning. | 1150 // but second navigation is started from the beginning. |
| 1150 if (!is_waiting_for_beforeunload_ack_) { | 1151 if (!is_waiting_for_beforeunload_ack_) { |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1915 | 1916 |
| 1916 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) { | 1917 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) { |
| 1917 // TODO(creis): Support beforeunload on subframes. For now just pretend that | 1918 // TODO(creis): Support beforeunload on subframes. For now just pretend that |
| 1918 // the handler ran and allowed the navigation to proceed. | 1919 // the handler ran and allowed the navigation to proceed. |
| 1919 if (!ShouldDispatchBeforeUnload()) { | 1920 if (!ShouldDispatchBeforeUnload()) { |
| 1920 DCHECK(!(IsBrowserSideNavigationEnabled() && for_navigation)); | 1921 DCHECK(!(IsBrowserSideNavigationEnabled() && for_navigation)); |
| 1921 frame_tree_node_->render_manager()->OnBeforeUnloadACK( | 1922 frame_tree_node_->render_manager()->OnBeforeUnloadACK( |
| 1922 for_navigation, true, base::TimeTicks::Now()); | 1923 for_navigation, true, base::TimeTicks::Now()); |
| 1923 return; | 1924 return; |
| 1924 } | 1925 } |
| 1925 TRACE_EVENT_ASYNC_BEGIN0( | 1926 TRACE_EVENT_ASYNC_BEGIN1("navigation", "RenderFrameHostImpl BeforeUnload", |
| 1926 "navigation", "RenderFrameHostImpl::BeforeUnload", this); | 1927 this, "&RenderFrameHostImpl", (void*)this); |
| 1927 | 1928 |
| 1928 // This may be called more than once (if the user clicks the tab close button | 1929 // This may be called more than once (if the user clicks the tab close button |
| 1929 // several times, or if she clicks the tab close button then the browser close | 1930 // several times, or if she clicks the tab close button then the browser close |
| 1930 // button), and we only send the message once. | 1931 // button), and we only send the message once. |
| 1931 if (is_waiting_for_beforeunload_ack_) { | 1932 if (is_waiting_for_beforeunload_ack_) { |
| 1932 // Some of our close messages could be for the tab, others for cross-site | 1933 // Some of our close messages could be for the tab, others for cross-site |
| 1933 // transitions. We always want to think it's for closing the tab if any | 1934 // transitions. We always want to think it's for closing the tab if any |
| 1934 // of the messages were, since otherwise it might be impossible to close | 1935 // of the messages were, since otherwise it might be impossible to close |
| 1935 // (if there was a cross-site "close" request pending when the user clicked | 1936 // (if there was a cross-site "close" request pending when the user clicked |
| 1936 // the close button). We want to keep the "for cross site" flag only if | 1937 // the close button). We want to keep the "for cross site" flag only if |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2505 *dst = src; | 2506 *dst = src; |
| 2506 | 2507 |
| 2507 if (src.routing_id != -1) | 2508 if (src.routing_id != -1) |
| 2508 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2509 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
| 2509 | 2510 |
| 2510 if (src.parent_routing_id != -1) | 2511 if (src.parent_routing_id != -1) |
| 2511 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2512 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
| 2512 } | 2513 } |
| 2513 | 2514 |
| 2514 } // namespace content | 2515 } // namespace content |
| OLD | NEW |