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

Unified Diff: third_party/WebKit/Source/core/page/Page.cpp

Issue 1583263002: Experimental CompressibleString UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DecompressingInForegroundTab Created 4 years, 11 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
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 6ed312c28645668efdf089e6a98768aae7dbaed9..043c7002d07ea4ce1aa4ebd0774398694523fc9b 100644
--- a/third_party/WebKit/Source/core/page/Page.cpp
+++ b/third_party/WebKit/Source/core/page/Page.cpp
@@ -50,6 +50,7 @@
#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 {
@@ -136,6 +137,7 @@ Page::Page(PageClients& pageClients)
, m_isPainting(false)
#endif
, m_frameHost(FrameHost::create(*this))
+ , m_timerForCompressStrings(this, &Page::compressStrings)
{
ASSERT(m_editorClient);
@@ -363,6 +365,9 @@ void Page::visitedStateChanged(LinkHash linkHash)
void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitialState)
{
+ static const double waitingTimeBeforeCompressingString = 10;
+
+ CompressibleStringImpl::setPageBackground(visibilityState == PageVisibilityStateHidden);
if (m_visibilityState == visibilityState)
return;
m_visibilityState = visibilityState;
@@ -372,6 +377,14 @@ void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia
if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame())
deprecatedLocalMainFrame()->didChangeVisibilityState();
+
+ // Compress CompressibleStrings when 10 seconds have passed since the page
+ // went to background.
+ if (m_visibilityState == PageVisibilityStateHidden && !m_timerForCompressStrings.isActive()) {
haraken 2016/01/19 07:43:35 Shouldn't this be: if (m_visibilityState == Pag
hajimehoshi 2016/01/19 10:19:20 Done.
+ m_timerForCompressStrings.startOneShot(waitingTimeBeforeCompressingString, BLINK_FROM_HERE);
+ } else if (m_timerForCompressStrings.isActive()) {
+ m_timerForCompressStrings.stop();
+ }
}
PageVisibilityState Page::visibilityState() const
@@ -584,6 +597,13 @@ 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)

Powered by Google App Engine
This is Rietveld 408576698