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

Side by Side Diff: third_party/WebKit/Source/core/page/Page.cpp

Issue 1477353002: Revert of Move throttling of background timers into the renderer scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 , m_contextMenuController(ContextMenuController::create(this, pageClients.co ntextMenuClient)) 110 , m_contextMenuController(ContextMenuController::create(this, pageClients.co ntextMenuClient))
111 , m_pointerLockController(PointerLockController::create(this)) 111 , m_pointerLockController(PointerLockController::create(this))
112 , m_undoStack(UndoStack::create()) 112 , m_undoStack(UndoStack::create())
113 , m_mainFrame(nullptr) 113 , m_mainFrame(nullptr)
114 , m_editorClient(pageClients.editorClient) 114 , m_editorClient(pageClients.editorClient)
115 , m_spellCheckerClient(pageClients.spellCheckerClient) 115 , m_spellCheckerClient(pageClients.spellCheckerClient)
116 , m_openedByDOM(false) 116 , m_openedByDOM(false)
117 , m_tabKeyCyclesThroughElements(true) 117 , m_tabKeyCyclesThroughElements(true)
118 , m_defersLoading(false) 118 , m_defersLoading(false)
119 , m_deviceScaleFactor(1) 119 , m_deviceScaleFactor(1)
120 , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval())
120 , m_visibilityState(PageVisibilityStateVisible) 121 , m_visibilityState(PageVisibilityStateVisible)
121 , m_isCursorVisible(true) 122 , m_isCursorVisible(true)
122 #if ENABLE(ASSERT) 123 #if ENABLE(ASSERT)
123 , m_isPainting(false) 124 , m_isPainting(false)
124 #endif 125 #endif
125 , m_frameHost(FrameHost::create(*this)) 126 , m_frameHost(FrameHost::create(*this))
126 { 127 {
127 ASSERT(m_editorClient); 128 ASSERT(m_editorClient);
128 129
129 ASSERT(!allPages().contains(this)); 130 ASSERT(!allPages().contains(this));
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 void Page::visitedStateChanged(LinkHash linkHash) 349 void Page::visitedStateChanged(LinkHash linkHash)
349 { 350 {
350 for (const Page* page : ordinaryPages()) { 351 for (const Page* page : ordinaryPages()) {
351 for (Frame* frame = page->m_mainFrame; frame; frame = frame->tree().trav erseNext()) { 352 for (Frame* frame = page->m_mainFrame; frame; frame = frame->tree().trav erseNext()) {
352 if (frame->isLocalFrame()) 353 if (frame->isLocalFrame())
353 toLocalFrame(frame)->document()->visitedLinkState().invalidateSt yleForLink(linkHash); 354 toLocalFrame(frame)->document()->visitedLinkState().invalidateSt yleForLink(linkHash);
354 } 355 }
355 } 356 }
356 } 357 }
357 358
359 void Page::setTimerAlignmentInterval(double interval)
360 {
361 if (interval == m_timerAlignmentInterval)
362 return;
363
364 m_timerAlignmentInterval = interval;
365 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNextWi thWrap(false)) {
366 if (!frame->isLocalFrame())
367 continue;
368
369 if (Document* document = toLocalFrame(frame)->document()) {
370 if (DOMTimerCoordinator* timers = document->timers()) {
371 timers->didChangeTimerAlignmentInterval();
372 }
373 }
374 }
375 }
376
377 double Page::timerAlignmentInterval() const
378 {
379 return m_timerAlignmentInterval;
380 }
381
358 void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia lState) 382 void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia lState)
359 { 383 {
360 if (m_visibilityState == visibilityState) 384 if (m_visibilityState == visibilityState)
361 return; 385 return;
362 m_visibilityState = visibilityState; 386 m_visibilityState = visibilityState;
363 387
388 // TODO(alexclarke): Move throttling of timers to chromium.
364 if (visibilityState == PageVisibilityStateVisible) { 389 if (visibilityState == PageVisibilityStateVisible) {
390 setTimerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval());
365 memoryPurgeController().pageBecameActive(); 391 memoryPurgeController().pageBecameActive();
366 } else { 392 } else {
393 setTimerAlignmentInterval(DOMTimer::hiddenPageAlignmentInterval());
367 if (!isInitialState) 394 if (!isInitialState)
368 memoryPurgeController().pageBecameInactive(); 395 memoryPurgeController().pageBecameInactive();
369 } 396 }
370 397
371 if (!isInitialState) 398 if (!isInitialState)
372 notifyPageVisibilityChanged(); 399 notifyPageVisibilityChanged();
373 400
374 if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame()) 401 if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame())
375 deprecatedLocalMainFrame()->didChangeVisibilityState(); 402 deprecatedLocalMainFrame()->didChangeVisibilityState();
376 } 403 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 { 613 {
587 } 614 }
588 615
589 Page::PageClients::~PageClients() 616 Page::PageClients::~PageClients()
590 { 617 {
591 } 618 }
592 619
593 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>; 620 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>;
594 621
595 } // namespace blink 622 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.h ('k') | third_party/WebKit/Source/core/testing/NullExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698