Chromium Code Reviews| 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 f82f7cea97ff15d102c421be69abde8152c55461..ca683e09983470da051bea3cb55b2866b39f37a7 100644 |
| --- a/third_party/WebKit/Source/core/page/Page.cpp |
| +++ b/third_party/WebKit/Source/core/page/Page.cpp |
| @@ -51,7 +51,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 { |
| @@ -130,7 +129,6 @@ Page::Page(PageClients& pageClients) |
| , m_isPainting(false) |
| #endif |
| , m_frameHost(FrameHost::create(*this)) |
| - , m_timerForCompressStrings(this, &Page::compressStrings) |
| { |
| ASSERT(m_editorClient); |
| @@ -317,8 +315,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; |
| @@ -328,15 +324,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) { |
|
esprehn
2016/08/05 23:00:58
is this actually enabled today?
tasak
2016/08/08 04:47:36
No, not enabled. I manually applied compressibleSt
|
| - if (!m_timerForCompressStrings.isActive()) |
| - m_timerForCompressStrings.startOneShot(waitingTimeBeforeCompressingString, BLINK_FROM_HERE); |
| - } else if (m_timerForCompressStrings.isActive()) { |
| - m_timerForCompressStrings.stop(); |
| - } |
| } |
| PageVisibilityState Page::visibilityState() const |
| @@ -477,6 +464,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); |
| @@ -533,13 +535,6 @@ void Page::willBeDestroyed() |
| PageVisibilityNotifier::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) |