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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTestHelper.cpp

Issue 2278723002: Evict resources from memory cache after running rendering test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Evict resources after running RenderingTest. Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "core/layout/LayoutTestHelper.h" 5 #include "core/layout/LayoutTestHelper.h"
6 6
7 #include "core/fetch/MemoryCache.h"
7 #include "core/frame/FrameHost.h" 8 #include "core/frame/FrameHost.h"
8 #include "core/html/HTMLIFrameElement.h" 9 #include "core/html/HTMLIFrameElement.h"
9 #include "platform/scroll/ScrollbarTheme.h" 10 #include "platform/scroll/ScrollbarTheme.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 RenderingTest::RenderingTest(FrameLoaderClient* frameLoaderClient) 14 RenderingTest::RenderingTest(FrameLoaderClient* frameLoaderClient)
14 : m_frameLoaderClient(frameLoaderClient) { } 15 : m_frameLoaderClient(frameLoaderClient) { }
15 16
16 void RenderingTest::SetUp() 17 void RenderingTest::SetUp()
(...skipping 18 matching lines...) Expand all
35 if (m_subframe) { 36 if (m_subframe) {
36 m_subframe->detach(FrameDetachType::Remove); 37 m_subframe->detach(FrameDetachType::Remove);
37 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client()) ->setChild(nullptr); 38 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client()) ->setChild(nullptr);
38 document().frame()->host()->decrementSubframeCount(); 39 document().frame()->host()->decrementSubframeCount();
39 } 40 }
40 41
41 // We need to destroy most of the Blink structure here because derived tests may restore 42 // We need to destroy most of the Blink structure here because derived tests may restore
42 // RuntimeEnabledFeatures setting during teardown, which happens before our destructor 43 // RuntimeEnabledFeatures setting during teardown, which happens before our destructor
43 // getting invoked, breaking the assumption that REF can't change during Bli nk lifetime. 44 // getting invoked, breaking the assumption that REF can't change during Bli nk lifetime.
44 m_pageHolder = nullptr; 45 m_pageHolder = nullptr;
46
47 // Clear memory cache, otherwise we can leak pruned resources.
48 memoryCache()->evictResources();
haraken 2016/08/26 00:58:49 Just help me understand: What's a difference betwe
45 } 49 }
46 50
47 Document& RenderingTest::setupChildIframe(const AtomicString& iframeElementId, c onst String& htmlContentOfIframe) 51 Document& RenderingTest::setupChildIframe(const AtomicString& iframeElementId, c onst String& htmlContentOfIframe)
48 { 52 {
49 // TODO(pdr): This should be refactored to share code with the actual setup 53 // TODO(pdr): This should be refactored to share code with the actual setup
50 // instead of partially duplicating it here (e.g., LocalFrame::createView). 54 // instead of partially duplicating it here (e.g., LocalFrame::createView).
51 HTMLIFrameElement& iframe = *toHTMLIFrameElement(document().getElementById(i frameElementId)); 55 HTMLIFrameElement& iframe = *toHTMLIFrameElement(document().getElementById(i frameElementId));
52 m_childFrameLoaderClient = FrameLoaderClientWithParent::create(document().fr ame()); 56 m_childFrameLoaderClient = FrameLoaderClientWithParent::create(document().fr ame());
53 m_subframe = LocalFrame::create(m_childFrameLoaderClient.get(), document().f rame()->host(), &iframe); 57 m_subframe = LocalFrame::create(m_childFrameLoaderClient.get(), document().f rame()->host(), &iframe);
54 m_subframe->setView(FrameView::create(m_subframe.get(), IntSize(500, 500))); 58 m_subframe->setView(FrameView::create(m_subframe.get(), IntSize(500, 500)));
55 m_subframe->init(); 59 m_subframe->init();
56 m_subframe->view()->setParentVisible(true); 60 m_subframe->view()->setParentVisible(true);
57 m_subframe->view()->setSelfVisible(true); 61 m_subframe->view()->setSelfVisible(true);
58 iframe.setWidget(m_subframe->view()); 62 iframe.setWidget(m_subframe->view());
59 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(m_subframe.get()); 63 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(m_subframe.get());
60 document().frame()->host()->incrementSubframeCount(); 64 document().frame()->host()->incrementSubframeCount();
61 Document& frameDocument = *iframe.contentDocument(); 65 Document& frameDocument = *iframe.contentDocument();
62 66
63 frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); 67 frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://test.com"));
64 frameDocument.body()->setInnerHTML(htmlContentOfIframe, ASSERT_NO_EXCEPTION) ; 68 frameDocument.body()->setInnerHTML(htmlContentOfIframe, ASSERT_NO_EXCEPTION) ;
65 return frameDocument; 69 return frameDocument;
66 } 70 }
67 71
68 } // namespace blink 72 } // namespace blink
OLDNEW
« 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