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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1725 // start using the RenderFrameProxy. | 1725 // start using the RenderFrameProxy. |
1726 // | 1726 // |
1727 // The swap call deletes this RenderFrame via frameDetached. Do not access | 1727 // The swap call deletes this RenderFrame via frameDetached. Do not access |
1728 // any members after this call. | 1728 // any members after this call. |
1729 // | 1729 // |
1730 // TODO(creis): WebFrame::swap() can return false. Most of those cases | 1730 // TODO(creis): WebFrame::swap() can return false. Most of those cases |
1731 // should be due to the frame being detached during unload (in which case | 1731 // should be due to the frame being detached during unload (in which case |
1732 // the necessary cleanup has happened anyway), but it might be possible for | 1732 // the necessary cleanup has happened anyway), but it might be possible for |
1733 // it to return false without detaching. Catch any cases that the | 1733 // it to return false without detaching. Catch any cases that the |
1734 // RenderView's main_render_frame_ isn't cleared below (whether swap returns | 1734 // RenderView's main_render_frame_ isn't cleared below (whether swap returns |
1735 // false or not), to track down https://crbug.com/575245. | 1735 // false or not). |
1736 bool success = frame_->swap(proxy->web_frame()); | 1736 bool success = frame_->swap(proxy->web_frame()); |
1737 | 1737 |
1738 // For main frames, the swap should have cleared the RenderView's pointer to | 1738 // For main frames, the swap should have cleared the RenderView's pointer to |
1739 // this frame. | 1739 // this frame. |
1740 if (is_main_frame) { | 1740 if (is_main_frame) |
1741 base::debug::SetCrashKeyValue("swapout_frame_id", | |
1742 base::IntToString(routing_id)); | |
1743 base::debug::SetCrashKeyValue("swapout_proxy_id", | |
1744 base::IntToString(proxy->routing_id())); | |
1745 base::debug::SetCrashKeyValue( | |
1746 "swapout_view_id", base::IntToString(render_view->GetRoutingID())); | |
1747 CHECK(!render_view->main_render_frame_); | 1741 CHECK(!render_view->main_render_frame_); |
1748 } | |
1749 | 1742 |
1750 if (!success) { | 1743 if (!success) { |
1751 // The swap can fail when the frame is detached during swap (this can | 1744 // The swap can fail when the frame is detached during swap (this can |
1752 // happen while running the unload handlers). When that happens, delete | 1745 // happen while running the unload handlers). When that happens, delete |
1753 // the proxy. | 1746 // the proxy. |
1754 proxy->frameDetached(blink::WebRemoteFrameClient::DetachType::Swap); | 1747 proxy->frameDetached(blink::WebRemoteFrameClient::DetachType::Swap); |
1755 return; | 1748 return; |
1756 } | 1749 } |
1757 | 1750 |
1758 if (is_loading) | 1751 if (is_loading) |
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3549 | 3542 |
3550 // The proxy might have been detached while the provisional LocalFrame was | 3543 // The proxy might have been detached while the provisional LocalFrame was |
3551 // being navigated. In that case, don't swap the frame back in the tree | 3544 // being navigated. In that case, don't swap the frame back in the tree |
3552 // and return early (to avoid sending confusing IPCs to the browser | 3545 // and return early (to avoid sending confusing IPCs to the browser |
3553 // process). See https://crbug.com/526304 and https://crbug.com/568676. | 3546 // process). See https://crbug.com/526304 and https://crbug.com/568676. |
3554 // TODO(nasko, alexmos): Eventually, the browser process will send an IPC | 3547 // TODO(nasko, alexmos): Eventually, the browser process will send an IPC |
3555 // to clean this frame up after https://crbug.com/548275 is fixed. | 3548 // to clean this frame up after https://crbug.com/548275 is fixed. |
3556 if (!proxy) | 3549 if (!proxy) |
3557 return; | 3550 return; |
3558 | 3551 |
3559 int proxy_routing_id = proxy_routing_id_; | |
3560 if (!proxy->web_frame()->swap(frame_)) | 3552 if (!proxy->web_frame()->swap(frame_)) |
3561 return; | 3553 return; |
3562 proxy_routing_id_ = MSG_ROUTING_NONE; | 3554 proxy_routing_id_ = MSG_ROUTING_NONE; |
3563 in_frame_tree_ = true; | 3555 in_frame_tree_ = true; |
3564 | 3556 |
3565 // If this is the main frame going from a remote frame to a local frame, | 3557 // If this is the main frame going from a remote frame to a local frame, |
3566 // it needs to set RenderViewImpl's pointer for the main frame to itself | 3558 // it needs to set RenderViewImpl's pointer for the main frame to itself |
3567 // and ensure RenderWidget is no longer in swapped out mode. | 3559 // and ensure RenderWidget is no longer in swapped out mode. |
3568 if (is_main_frame_) { | 3560 if (is_main_frame_) { |
3569 // Debug cases of https://crbug.com/575245. | |
3570 base::debug::SetCrashKeyValue("commit_frame_id", | |
3571 base::IntToString(GetRoutingID())); | |
3572 base::debug::SetCrashKeyValue("commit_proxy_id", | |
3573 base::IntToString(proxy_routing_id)); | |
3574 base::debug::SetCrashKeyValue( | |
3575 "commit_view_id", base::IntToString(render_view_->GetRoutingID())); | |
3576 if (render_view_->main_render_frame_) { | |
3577 base::debug::SetCrashKeyValue( | |
3578 "commit_main_render_frame_id", | |
3579 base::IntToString( | |
3580 render_view_->main_render_frame_->GetRoutingID())); | |
3581 } | |
3582 CHECK(!render_view_->main_render_frame_); | 3561 CHECK(!render_view_->main_render_frame_); |
3583 render_view_->main_render_frame_ = this; | 3562 render_view_->main_render_frame_ = this; |
3584 if (render_view_->is_swapped_out()) | 3563 if (render_view_->is_swapped_out()) |
3585 render_view_->SetSwappedOut(false); | 3564 render_view_->SetSwappedOut(false); |
3586 } | 3565 } |
3587 } | 3566 } |
3588 | 3567 |
3589 // For new page navigations, the browser process needs to be notified of the | 3568 // For new page navigations, the browser process needs to be notified of the |
3590 // first paint of that page, so it can cancel the timer that waits for it. | 3569 // first paint of that page, so it can cancel the timer that waits for it. |
3591 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) { | 3570 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) { |
(...skipping 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6681 // event target. Potentially a Pepper plugin will receive the event. | 6660 // event target. Potentially a Pepper plugin will receive the event. |
6682 // In order to tell whether a plugin gets the last mouse event and which it | 6661 // In order to tell whether a plugin gets the last mouse event and which it |
6683 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6662 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6684 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6663 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6685 // |pepper_last_mouse_event_target_|. | 6664 // |pepper_last_mouse_event_target_|. |
6686 pepper_last_mouse_event_target_ = nullptr; | 6665 pepper_last_mouse_event_target_ = nullptr; |
6687 #endif | 6666 #endif |
6688 } | 6667 } |
6689 | 6668 |
6690 } // namespace content | 6669 } // namespace content |
OLD | NEW |