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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More build fixes Created 4 years, 4 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 { 1924 {
1925 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::createWit hExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)); 1925 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::createWit hExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus));
1926 } 1926 }
1927 1927
1928 void Document::clearFocusedElementSoon() 1928 void Document::clearFocusedElementSoon()
1929 { 1929 {
1930 if (!m_clearFocusedElementTimer.isActive()) 1930 if (!m_clearFocusedElementTimer.isActive())
1931 m_clearFocusedElementTimer.startOneShot(0, BLINK_FROM_HERE); 1931 m_clearFocusedElementTimer.startOneShot(0, BLINK_FROM_HERE);
1932 } 1932 }
1933 1933
1934 void Document::clearFocusedElementTimerFired(Timer<Document>*) 1934 void Document::clearFocusedElementTimerFired(TimerBase*)
1935 { 1935 {
1936 updateStyleAndLayoutTree(); 1936 updateStyleAndLayoutTree();
1937 m_clearFocusedElementTimer.stop(); 1937 m_clearFocusedElementTimer.stop();
1938 1938
1939 if (m_focusedElement && !m_focusedElement->isFocusable()) 1939 if (m_focusedElement && !m_focusedElement->isFocusable())
1940 m_focusedElement->blur(); 1940 m_focusedElement->blur();
1941 } 1941 }
1942 1942
1943 // FIXME: This is a bad idea and needs to be removed eventually. 1943 // FIXME: This is a bad idea and needs to be removed eventually.
1944 // Other browsers load stylesheets before they continue parsing the web page. 1944 // Other browsers load stylesheets before they continue parsing the web page.
(...skipping 2874 matching lines...) Expand 10 before | Expand all | Expand 10 after
4819 // Schedule dropping of the ElementDataCache. We keep it alive for a while a fter parsing finishes 4819 // Schedule dropping of the ElementDataCache. We keep it alive for a while a fter parsing finishes
4820 // so that dynamically inserted content can also benefit from sharing optimi zations. 4820 // so that dynamically inserted content can also benefit from sharing optimi zations.
4821 // Note that we don't refresh the timer on cache access since that could lea d to huge caches being kept 4821 // Note that we don't refresh the timer on cache access since that could lea d to huge caches being kept
4822 // alive indefinitely by something innocuous like JS setting .innerHTML repe atedly on a timer. 4822 // alive indefinitely by something innocuous like JS setting .innerHTML repe atedly on a timer.
4823 m_elementDataCacheClearTimer.startOneShot(10, BLINK_FROM_HERE); 4823 m_elementDataCacheClearTimer.startOneShot(10, BLINK_FROM_HERE);
4824 4824
4825 // Parser should have picked up all preloads by now 4825 // Parser should have picked up all preloads by now
4826 m_fetcher->clearPreloads(ResourceFetcher::ClearSpeculativeMarkupPreloads); 4826 m_fetcher->clearPreloads(ResourceFetcher::ClearSpeculativeMarkupPreloads);
4827 } 4827 }
4828 4828
4829 void Document::elementDataCacheClearTimerFired(Timer<Document>*) 4829 void Document::elementDataCacheClearTimerFired(TimerBase*)
4830 { 4830 {
4831 m_elementDataCache.clear(); 4831 m_elementDataCache.clear();
4832 } 4832 }
4833 4833
4834 void Document::beginLifecycleUpdatesIfRenderingReady() 4834 void Document::beginLifecycleUpdatesIfRenderingReady()
4835 { 4835 {
4836 if (!isActive()) 4836 if (!isActive())
4837 return; 4837 return;
4838 if (!isRenderingReady()) 4838 if (!isRenderingReady())
4839 return; 4839 return;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
5129 m_updateFocusAppearanceSelectionBahavior = selectionbehavioronfocus; 5129 m_updateFocusAppearanceSelectionBahavior = selectionbehavioronfocus;
5130 if (!m_updateFocusAppearanceTimer.isActive()) 5130 if (!m_updateFocusAppearanceTimer.isActive())
5131 m_updateFocusAppearanceTimer.startOneShot(0, BLINK_FROM_HERE); 5131 m_updateFocusAppearanceTimer.startOneShot(0, BLINK_FROM_HERE);
5132 } 5132 }
5133 5133
5134 void Document::cancelFocusAppearanceUpdate() 5134 void Document::cancelFocusAppearanceUpdate()
5135 { 5135 {
5136 m_updateFocusAppearanceTimer.stop(); 5136 m_updateFocusAppearanceTimer.stop();
5137 } 5137 }
5138 5138
5139 void Document::updateFocusAppearanceTimerFired(Timer<Document>*) 5139 void Document::updateFocusAppearanceTimerFired(TimerBase*)
5140 { 5140 {
5141 Element* element = focusedElement(); 5141 Element* element = focusedElement();
5142 if (!element) 5142 if (!element)
5143 return; 5143 return;
5144 updateStyleAndLayout(); 5144 updateStyleAndLayout();
5145 if (element->isFocusable()) 5145 if (element->isFocusable())
5146 element->updateFocusAppearance(m_updateFocusAppearanceSelectionBahavior) ; 5146 element->updateFocusAppearance(m_updateFocusAppearanceSelectionBahavior) ;
5147 } 5147 }
5148 5148
5149 void Document::attachRange(Range* range) 5149 void Document::attachRange(Range* range)
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
5376 // incrementLoadEventDelayCount and decrementLoadEventDelayCount in 5376 // incrementLoadEventDelayCount and decrementLoadEventDelayCount in
5377 // Node destructors. 5377 // Node destructors.
5378 if (ThreadState::current()->sweepForbidden()) { 5378 if (ThreadState::current()->sweepForbidden()) {
5379 if (!m_loadEventDelayCount) 5379 if (!m_loadEventDelayCount)
5380 checkLoadEventSoon(); 5380 checkLoadEventSoon();
5381 return true; 5381 return true;
5382 } 5382 }
5383 return m_loadEventDelayCount; 5383 return m_loadEventDelayCount;
5384 } 5384 }
5385 5385
5386 void Document::loadEventDelayTimerFired(Timer<Document>*) 5386 void Document::loadEventDelayTimerFired(TimerBase*)
5387 { 5387 {
5388 if (frame()) 5388 if (frame())
5389 frame()->loader().checkCompleted(); 5389 frame()->loader().checkCompleted();
5390 } 5390 }
5391 5391
5392 void Document::loadPluginsSoon() 5392 void Document::loadPluginsSoon()
5393 { 5393 {
5394 // FIXME: Remove this timer once we don't need to compute layout to load plu gins. 5394 // FIXME: Remove this timer once we don't need to compute layout to load plu gins.
5395 if (!m_pluginLoadingTimer.isActive()) 5395 if (!m_pluginLoadingTimer.isActive())
5396 m_pluginLoadingTimer.startOneShot(0, BLINK_FROM_HERE); 5396 m_pluginLoadingTimer.startOneShot(0, BLINK_FROM_HERE);
5397 } 5397 }
5398 5398
5399 void Document::pluginLoadingTimerFired(Timer<Document>*) 5399 void Document::pluginLoadingTimerFired(TimerBase*)
5400 { 5400 {
5401 updateStyleAndLayout(); 5401 updateStyleAndLayout();
5402 } 5402 }
5403 5403
5404 ScriptedAnimationController& Document::ensureScriptedAnimationController() 5404 ScriptedAnimationController& Document::ensureScriptedAnimationController()
5405 { 5405 {
5406 if (!m_scriptedAnimationController) { 5406 if (!m_scriptedAnimationController) {
5407 m_scriptedAnimationController = ScriptedAnimationController::create(this ); 5407 m_scriptedAnimationController = ScriptedAnimationController::create(this );
5408 // We need to make sure that we don't start up the animation controller on a background tab, for example. 5408 // We need to make sure that we don't start up the animation controller on a background tab, for example.
5409 if (!page()) 5409 if (!page())
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
5744 5744
5745 // We add a slight delay because this could be called rapidly. 5745 // We add a slight delay because this could be called rapidly.
5746 if (!m_didAssociateFormControlsTimer.isActive()) 5746 if (!m_didAssociateFormControlsTimer.isActive())
5747 m_didAssociateFormControlsTimer.startOneShot(0.3, BLINK_FROM_HERE); 5747 m_didAssociateFormControlsTimer.startOneShot(0.3, BLINK_FROM_HERE);
5748 } 5748 }
5749 5749
5750 void Document::removeFormAssociation(Element* element) 5750 void Document::removeFormAssociation(Element* element)
5751 { 5751 {
5752 } 5752 }
5753 5753
5754 void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer) 5754 void Document::didAssociateFormControlsTimerFired(TimerBase* timer)
5755 { 5755 {
5756 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); 5756 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer);
5757 if (!frame() || !frame()->page()) 5757 if (!frame() || !frame()->page())
5758 return; 5758 return;
5759 5759
5760 frame()->page()->chromeClient().didAssociateFormControlsAfterLoad(frame()); 5760 frame()->page()->chromeClient().didAssociateFormControlsAfterLoad(frame());
5761 } 5761 }
5762 5762
5763 float Document::devicePixelRatio() const 5763 float Document::devicePixelRatio() const
5764 { 5764 {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
6038 } 6038 }
6039 6039
6040 void showLiveDocumentInstances() 6040 void showLiveDocumentInstances()
6041 { 6041 {
6042 WeakDocumentSet& set = liveDocumentSet(); 6042 WeakDocumentSet& set = liveDocumentSet();
6043 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6043 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6044 for (Document* document : set) 6044 for (Document* document : set)
6045 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6045 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6046 } 6046 }
6047 #endif 6047 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/Fullscreen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698