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

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: 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_timer(this, &Page::compressStrings)
haraken 2016/01/15 12:46:21 m_timer => m_timerForCompressStrings
hajimehoshi 2016/01/18 09:42:26 Done.
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 CompressibleStringImpl::setPageBackground(visibilityState == PageVisibilityS tateHidden);
366 if (m_visibilityState == visibilityState) 369 if (m_visibilityState == visibilityState)
367 return; 370 return;
368 m_visibilityState = visibilityState; 371 m_visibilityState = visibilityState;
369 372
370 if (!isInitialState) 373 if (!isInitialState)
371 notifyPageVisibilityChanged(); 374 notifyPageVisibilityChanged();
372 375
373 if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame()) 376 if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame())
374 deprecatedLocalMainFrame()->didChangeVisibilityState(); 377 deprecatedLocalMainFrame()->didChangeVisibilityState();
378
379 if (m_visibilityState == PageVisibilityStateHidden && !m_timer.isActive()) {
380 m_timer.startOneShot(10, BLINK_FROM_HERE);
haraken 2016/01/15 12:46:21 Add a comment what you're doing this. // Compress
haraken 2016/01/15 12:46:21 Avoid hard-coding 10. static const double waiti
hajimehoshi 2016/01/18 09:42:26 Done.
hajimehoshi 2016/01/18 09:42:26 Done.
381 } else if (m_timer.isActive()) {
382 m_timer.stop();
383 }
375 } 384 }
376 385
377 PageVisibilityState Page::visibilityState() const 386 PageVisibilityState Page::visibilityState() const
378 { 387 {
379 return m_visibilityState; 388 return m_visibilityState;
380 } 389 }
381 390
382 bool Page::isCursorVisible() const 391 bool Page::isCursorVisible() const
383 { 392 {
384 return m_isCursorVisible && settings().deviceSupportsMouse(); 393 return m_isCursorVisible && settings().deviceSupportsMouse();
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 m_scrollingCoordinator->willBeDestroyed(); 586 m_scrollingCoordinator->willBeDestroyed();
578 587
579 chromeClient().chromeDestroyed(); 588 chromeClient().chromeDestroyed();
580 if (m_validationMessageClient) 589 if (m_validationMessageClient)
581 m_validationMessageClient->willBeDestroyed(); 590 m_validationMessageClient->willBeDestroyed();
582 m_mainFrame = nullptr; 591 m_mainFrame = nullptr;
583 592
584 PageLifecycleNotifier::notifyContextDestroyed(); 593 PageLifecycleNotifier::notifyContextDestroyed();
585 } 594 }
586 595
596 void Page::compressStrings(Timer<Page>* timer)
597 {
598 ASSERT_UNUSED(timer, timer == &m_timer);
599 if (m_visibilityState == PageVisibilityStateHidden)
600 CompressibleStringImpl::compressAll();
601 }
602
587 Page::PageClients::PageClients() 603 Page::PageClients::PageClients()
588 : chromeClient(nullptr) 604 : chromeClient(nullptr)
589 , contextMenuClient(nullptr) 605 , contextMenuClient(nullptr)
590 , editorClient(nullptr) 606 , editorClient(nullptr)
591 , dragClient(nullptr) 607 , dragClient(nullptr)
592 , spellCheckerClient(nullptr) 608 , spellCheckerClient(nullptr)
593 { 609 {
594 } 610 }
595 611
596 Page::PageClients::~PageClients() 612 Page::PageClients::~PageClients()
597 { 613 {
598 } 614 }
599 615
600 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>; 616 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>;
601 617
602 } // namespace blink 618 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698