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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All R ights Reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All R ights Reserved.
3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "core/page/ChromeClient.h" 43 #include "core/page/ChromeClient.h"
44 #include "core/page/ContextMenuController.h" 44 #include "core/page/ContextMenuController.h"
45 #include "core/page/DragController.h" 45 #include "core/page/DragController.h"
46 #include "core/page/FocusController.h" 46 #include "core/page/FocusController.h"
47 #include "core/page/PointerLockController.h" 47 #include "core/page/PointerLockController.h"
48 #include "core/page/ValidationMessageClient.h" 48 #include "core/page/ValidationMessageClient.h"
49 #include "core/page/scrolling/ScrollingCoordinator.h" 49 #include "core/page/scrolling/ScrollingCoordinator.h"
50 #include "core/paint/PaintLayer.h" 50 #include "core/paint/PaintLayer.h"
51 #include "platform/graphics/GraphicsLayer.h" 51 #include "platform/graphics/GraphicsLayer.h"
52 #include "platform/plugins/PluginData.h" 52 #include "platform/plugins/PluginData.h"
53 #include "platform/text/CompressibleString.h"
53 #include "public/platform/Platform.h" 54 #include "public/platform/Platform.h"
54 55
55 namespace blink { 56 namespace blink {
56 57
57 // Set of all live pages; includes internal Page objects that are 58 // Set of all live pages; includes internal Page objects that are
58 // not observable from scripts. 59 // not observable from scripts.
59 static Page::PageSet& allPages() 60 static Page::PageSet& allPages()
60 { 61 {
61 DEFINE_STATIC_LOCAL(Page::PageSet, allPages, ()); 62 DEFINE_STATIC_LOCAL(Page::PageSet, allPages, ());
62 return allPages; 63 return allPages;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 , m_openedByDOM(false) 130 , m_openedByDOM(false)
130 , m_tabKeyCyclesThroughElements(true) 131 , m_tabKeyCyclesThroughElements(true)
131 , m_defersLoading(false) 132 , m_defersLoading(false)
132 , m_deviceScaleFactor(1) 133 , m_deviceScaleFactor(1)
133 , m_visibilityState(PageVisibilityStateVisible) 134 , m_visibilityState(PageVisibilityStateVisible)
134 , m_isCursorVisible(true) 135 , m_isCursorVisible(true)
135 #if ENABLE(ASSERT) 136 #if ENABLE(ASSERT)
136 , m_isPainting(false) 137 , m_isPainting(false)
137 #endif 138 #endif
138 , m_frameHost(FrameHost::create(*this)) 139 , m_frameHost(FrameHost::create(*this))
140 , m_timerForCompressStrings(this, &Page::compressStrings)
139 { 141 {
140 ASSERT(m_editorClient); 142 ASSERT(m_editorClient);
141 143
142 ASSERT(!allPages().contains(this)); 144 ASSERT(!allPages().contains(this));
143 allPages().add(this); 145 allPages().add(this);
144 } 146 }
145 147
146 Page::~Page() 148 Page::~Page()
147 { 149 {
148 #if !ENABLE(OILPAN) 150 #if !ENABLE(OILPAN)
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 for (const Page* page : ordinaryPages()) { 358 for (const Page* page : ordinaryPages()) {
357 for (Frame* frame = page->m_mainFrame; frame; frame = frame->tree().trav erseNext()) { 359 for (Frame* frame = page->m_mainFrame; frame; frame = frame->tree().trav erseNext()) {
358 if (frame->isLocalFrame()) 360 if (frame->isLocalFrame())
359 toLocalFrame(frame)->document()->visitedLinkState().invalidateSt yleForLink(linkHash); 361 toLocalFrame(frame)->document()->visitedLinkState().invalidateSt yleForLink(linkHash);
360 } 362 }
361 } 363 }
362 } 364 }
363 365
364 void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia lState) 366 void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia lState)
365 { 367 {
368 static const double waitingTimeBeforeCompressingString = 10;
369
370 CompressibleStringImpl::setPageBackground(visibilityState == PageVisibilityS tateHidden);
366 if (m_visibilityState == visibilityState) 371 if (m_visibilityState == visibilityState)
367 return; 372 return;
368 m_visibilityState = visibilityState; 373 m_visibilityState = visibilityState;
369 374
370 if (!isInitialState) 375 if (!isInitialState)
371 notifyPageVisibilityChanged(); 376 notifyPageVisibilityChanged();
372 377
373 if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame()) 378 if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame())
374 deprecatedLocalMainFrame()->didChangeVisibilityState(); 379 deprecatedLocalMainFrame()->didChangeVisibilityState();
380
381 // Compress CompressibleStrings when 10 seconds have passed since the page
382 // went to background.
383 if (m_visibilityState == PageVisibilityStateHidden && !m_timerForCompressStr ings.isActive()) {
haraken 2016/01/19 07:43:35 Shouldn't this be: if (m_visibilityState == Pag
hajimehoshi 2016/01/19 10:19:20 Done.
384 m_timerForCompressStrings.startOneShot(waitingTimeBeforeCompressingStrin g, BLINK_FROM_HERE);
385 } else if (m_timerForCompressStrings.isActive()) {
386 m_timerForCompressStrings.stop();
387 }
375 } 388 }
376 389
377 PageVisibilityState Page::visibilityState() const 390 PageVisibilityState Page::visibilityState() const
378 { 391 {
379 return m_visibilityState; 392 return m_visibilityState;
380 } 393 }
381 394
382 bool Page::isCursorVisible() const 395 bool Page::isCursorVisible() const
383 { 396 {
384 return m_isCursorVisible && settings().deviceSupportsMouse(); 397 return m_isCursorVisible && settings().deviceSupportsMouse();
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 m_scrollingCoordinator->willBeDestroyed(); 590 m_scrollingCoordinator->willBeDestroyed();
578 591
579 chromeClient().chromeDestroyed(); 592 chromeClient().chromeDestroyed();
580 if (m_validationMessageClient) 593 if (m_validationMessageClient)
581 m_validationMessageClient->willBeDestroyed(); 594 m_validationMessageClient->willBeDestroyed();
582 m_mainFrame = nullptr; 595 m_mainFrame = nullptr;
583 596
584 PageLifecycleNotifier::notifyContextDestroyed(); 597 PageLifecycleNotifier::notifyContextDestroyed();
585 } 598 }
586 599
600 void Page::compressStrings(Timer<Page>* timer)
601 {
602 ASSERT_UNUSED(timer, timer == &m_timerForCompressStrings);
603 if (m_visibilityState == PageVisibilityStateHidden)
604 CompressibleStringImpl::compressAll();
605 }
606
587 Page::PageClients::PageClients() 607 Page::PageClients::PageClients()
588 : chromeClient(nullptr) 608 : chromeClient(nullptr)
589 , contextMenuClient(nullptr) 609 , contextMenuClient(nullptr)
590 , editorClient(nullptr) 610 , editorClient(nullptr)
591 , dragClient(nullptr) 611 , dragClient(nullptr)
592 , spellCheckerClient(nullptr) 612 , spellCheckerClient(nullptr)
593 { 613 {
594 } 614 }
595 615
596 Page::PageClients::~PageClients() 616 Page::PageClients::~PageClients()
597 { 617 {
598 } 618 }
599 619
600 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>; 620 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>;
601 621
602 } // namespace blink 622 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698