OLD | NEW |
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 Loading... |
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()) | |
121 , m_visibilityState(PageVisibilityStateVisible) | 120 , m_visibilityState(PageVisibilityStateVisible) |
122 , m_isCursorVisible(true) | 121 , m_isCursorVisible(true) |
123 #if ENABLE(ASSERT) | 122 #if ENABLE(ASSERT) |
124 , m_isPainting(false) | 123 , m_isPainting(false) |
125 #endif | 124 #endif |
126 , m_frameHost(FrameHost::create(*this)) | 125 , m_frameHost(FrameHost::create(*this)) |
127 { | 126 { |
128 ASSERT(m_editorClient); | 127 ASSERT(m_editorClient); |
129 | 128 |
130 ASSERT(!allPages().contains(this)); | 129 ASSERT(!allPages().contains(this)); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 void Page::visitedStateChanged(LinkHash linkHash) | 348 void Page::visitedStateChanged(LinkHash linkHash) |
350 { | 349 { |
351 for (const Page* page : ordinaryPages()) { | 350 for (const Page* page : ordinaryPages()) { |
352 for (Frame* frame = page->m_mainFrame; frame; frame = frame->tree().trav
erseNext()) { | 351 for (Frame* frame = page->m_mainFrame; frame; frame = frame->tree().trav
erseNext()) { |
353 if (frame->isLocalFrame()) | 352 if (frame->isLocalFrame()) |
354 toLocalFrame(frame)->document()->visitedLinkState().invalidateSt
yleForLink(linkHash); | 353 toLocalFrame(frame)->document()->visitedLinkState().invalidateSt
yleForLink(linkHash); |
355 } | 354 } |
356 } | 355 } |
357 } | 356 } |
358 | 357 |
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 | |
382 void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia
lState) | 358 void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia
lState) |
383 { | 359 { |
384 if (m_visibilityState == visibilityState) | 360 if (m_visibilityState == visibilityState) |
385 return; | 361 return; |
386 m_visibilityState = visibilityState; | 362 m_visibilityState = visibilityState; |
387 | 363 |
388 // TODO(alexclarke): Move throttling of timers to chromium. | |
389 if (visibilityState == PageVisibilityStateVisible) { | 364 if (visibilityState == PageVisibilityStateVisible) { |
390 setTimerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval()); | |
391 memoryPurgeController().pageBecameActive(); | 365 memoryPurgeController().pageBecameActive(); |
392 } else { | 366 } else { |
393 setTimerAlignmentInterval(DOMTimer::hiddenPageAlignmentInterval()); | |
394 if (!isInitialState) | 367 if (!isInitialState) |
395 memoryPurgeController().pageBecameInactive(); | 368 memoryPurgeController().pageBecameInactive(); |
396 } | 369 } |
397 | 370 |
398 if (!isInitialState) | 371 if (!isInitialState) |
399 notifyPageVisibilityChanged(); | 372 notifyPageVisibilityChanged(); |
400 | 373 |
401 if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame()) | 374 if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame()) |
402 deprecatedLocalMainFrame()->didChangeVisibilityState(); | 375 deprecatedLocalMainFrame()->didChangeVisibilityState(); |
403 } | 376 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 { | 586 { |
614 } | 587 } |
615 | 588 |
616 Page::PageClients::~PageClients() | 589 Page::PageClients::~PageClients() |
617 { | 590 { |
618 } | 591 } |
619 | 592 |
620 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>; | 593 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Page>; |
621 | 594 |
622 } // namespace blink | 595 } // namespace blink |
OLD | NEW |