Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 1414193002: Plug RemoteFrame leak in WebFrameTest.SwapMainFrameWhileLoading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 575676031f3e38dae4b38e7c5a93e4d394b832db..311e60a25111bfc8dfa2ddd7a3215ecb4bdb7f46 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -7068,14 +7068,26 @@ namespace {
class SwapMainFrameWhenTitleChangesWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
public:
- SwapMainFrameWhenTitleChangesWebFrameClient() {}
- ~SwapMainFrameWhenTitleChangesWebFrameClient() override {}
+ SwapMainFrameWhenTitleChangesWebFrameClient()
+ : m_remoteFrame(nullptr)
+ {
+ }
+
+ ~SwapMainFrameWhenTitleChangesWebFrameClient() override
+ {
+ if (m_remoteFrame)
+ m_remoteFrame->close();
+ }
void didReceiveTitle(WebLocalFrame* frame, const WebString&, WebTextDirection) override
{
- if (!frame->parent())
- frame->swap(WebRemoteFrame::create(WebTreeScopeType::Document, nullptr));
+ if (!frame->parent()) {
+ m_remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, nullptr);
+ frame->swap(m_remoteFrame);
+ }
}
+private:
+ WebRemoteFrame* m_remoteFrame;
};
} // anonymous namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698