| Index: third_party/WebKit/Source/core/page/Page.cpp
|
| diff --git a/third_party/WebKit/Source/core/page/Page.cpp b/third_party/WebKit/Source/core/page/Page.cpp
|
| index ff71fae0c65ade2aa799053f8718ba2b8a3e55f3..99ac3a5af71e51c78942878899ac65603c1dd8f3 100644
|
| --- a/third_party/WebKit/Source/core/page/Page.cpp
|
| +++ b/third_party/WebKit/Source/core/page/Page.cpp
|
| @@ -49,7 +49,6 @@
|
| #include "core/paint/PaintLayer.h"
|
| #include "platform/graphics/GraphicsLayer.h"
|
| #include "platform/plugins/PluginData.h"
|
| -#include "platform/text/CompressibleString.h"
|
| #include "public/platform/Platform.h"
|
|
|
| namespace blink {
|
| @@ -128,7 +127,6 @@ Page::Page(PageClients& pageClients)
|
| , m_isPainting(false)
|
| #endif
|
| , m_frameHost(FrameHost::create(*this))
|
| - , m_timerForCompressStrings(this, &Page::compressStrings)
|
| {
|
| ASSERT(m_editorClient);
|
|
|
| @@ -315,8 +313,6 @@ void Page::visitedStateChanged(LinkHash linkHash)
|
|
|
| void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitialState)
|
| {
|
| - static const double waitingTimeBeforeCompressingString = 10;
|
| -
|
| if (m_visibilityState == visibilityState)
|
| return;
|
| m_visibilityState = visibilityState;
|
| @@ -326,15 +322,6 @@ void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia
|
|
|
| if (!isInitialState && m_mainFrame)
|
| m_mainFrame->didChangeVisibilityState();
|
| -
|
| - // Compress CompressibleStrings when 10 seconds have passed since the page
|
| - // went to background.
|
| - if (m_visibilityState == PageVisibilityStateHidden) {
|
| - if (!m_timerForCompressStrings.isActive())
|
| - m_timerForCompressStrings.startOneShot(waitingTimeBeforeCompressingString, BLINK_FROM_HERE);
|
| - } else if (m_timerForCompressStrings.isActive()) {
|
| - m_timerForCompressStrings.stop();
|
| - }
|
| }
|
|
|
| PageVisibilityState Page::visibilityState() const
|
| @@ -461,6 +448,21 @@ void Page::acceptLanguagesChanged()
|
| frames[i]->localDOMWindow()->acceptLanguagesChanged();
|
| }
|
|
|
| +void Page::purgeMemory()
|
| +{
|
| + // Ask each frame to purge memory.
|
| + for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
|
| + if (frame->isLocalFrame())
|
| + toLocalFrame(frame)->purgeMemory();
|
| + }
|
| +}
|
| +
|
| +void Page::onMemoryPressure()
|
| +{
|
| + for (Page* page : allPages())
|
| + page->purgeMemory();
|
| +}
|
| +
|
| DEFINE_TRACE(Page)
|
| {
|
| visitor->trace(m_animator);
|
| @@ -517,13 +519,6 @@ void Page::willBeDestroyed()
|
| PageLifecycleNotifier::notifyContextDestroyed();
|
| }
|
|
|
| -void Page::compressStrings(Timer<Page>* timer)
|
| -{
|
| - ASSERT_UNUSED(timer, timer == &m_timerForCompressStrings);
|
| - if (m_visibilityState == PageVisibilityStateHidden)
|
| - CompressibleStringImpl::compressAll();
|
| -}
|
| -
|
| Page::PageClients::PageClients()
|
| : chromeClient(nullptr)
|
| , contextMenuClient(nullptr)
|
|
|