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

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

Issue 301233010: Oilpan: use transition types for remaining RefPtr<Document>s in dom/. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 2627 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 } 2638 }
2639 2639
2640 bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio n) 2640 bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio n)
2641 { 2641 {
2642 if (!m_domWindow) 2642 if (!m_domWindow)
2643 return true; 2643 return true;
2644 2644
2645 if (!body()) 2645 if (!body())
2646 return true; 2646 return true;
2647 2647
2648 RefPtr<Document> protect(this); 2648 RefPtrWillBeRawPtr<Document> protect(this);
2649 2649
2650 RefPtrWillBeRawPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent: :create(); 2650 RefPtrWillBeRawPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent: :create();
2651 m_loadEventProgress = BeforeUnloadEventInProgress; 2651 m_loadEventProgress = BeforeUnloadEventInProgress;
2652 m_domWindow->dispatchEvent(beforeUnloadEvent.get(), this); 2652 m_domWindow->dispatchEvent(beforeUnloadEvent.get(), this);
2653 m_loadEventProgress = BeforeUnloadEventCompleted; 2653 m_loadEventProgress = BeforeUnloadEventCompleted;
2654 if (!beforeUnloadEvent->defaultPrevented()) 2654 if (!beforeUnloadEvent->defaultPrevented())
2655 defaultEventHandler(beforeUnloadEvent.get()); 2655 defaultEventHandler(beforeUnloadEvent.get());
2656 if (beforeUnloadEvent->returnValue().isNull()) 2656 if (beforeUnloadEvent->returnValue().isNull())
2657 return true; 2657 return true;
2658 2658
2659 if (didAllowNavigation) { 2659 if (didAllowNavigation) {
2660 addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt t o show multiple 'beforeunload' confirmation panels for a single navigation."); 2660 addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt t o show multiple 'beforeunload' confirmation panels for a single navigation.");
2661 return true; 2661 return true;
2662 } 2662 }
2663 2663
2664 String text = beforeUnloadEvent->returnValue(); 2664 String text = beforeUnloadEvent->returnValue();
2665 if (chrome.runBeforeUnloadConfirmPanel(text, m_frame)) { 2665 if (chrome.runBeforeUnloadConfirmPanel(text, m_frame)) {
2666 didAllowNavigation = true; 2666 didAllowNavigation = true;
2667 return true; 2667 return true;
2668 } 2668 }
2669 return false; 2669 return false;
2670 } 2670 }
2671 2671
2672 void Document::dispatchUnloadEvents() 2672 void Document::dispatchUnloadEvents()
2673 { 2673 {
2674 RefPtr<Document> protect(this); 2674 RefPtrWillBeRawPtr<Document> protect(this);
2675 if (m_parser) 2675 if (m_parser)
2676 m_parser->stopParsing(); 2676 m_parser->stopParsing();
2677 2677
2678 if (m_loadEventProgress >= LoadEventTried && m_loadEventProgress <= UnloadEv entInProgress) { 2678 if (m_loadEventProgress >= LoadEventTried && m_loadEventProgress <= UnloadEv entInProgress) {
2679 Element* currentFocusedElement = focusedElement(); 2679 Element* currentFocusedElement = focusedElement();
2680 if (isHTMLInputElement(currentFocusedElement)) 2680 if (isHTMLInputElement(currentFocusedElement))
2681 toHTMLInputElement(*currentFocusedElement).endEditing(); 2681 toHTMLInputElement(*currentFocusedElement).endEditing();
2682 if (m_loadEventProgress < PageHideInProgress) { 2682 if (m_loadEventProgress < PageHideInProgress) {
2683 m_loadEventProgress = PageHideInProgress; 2683 m_loadEventProgress = PageHideInProgress;
2684 if (DOMWindow* window = domWindow()) 2684 if (DOMWindow* window = domWindow())
(...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after
4647 // Reset the text autosizing multipliers on main frame when DOM is loade d. 4647 // Reset the text autosizing multipliers on main frame when DOM is loade d.
4648 // This is to allow for a fresh text autosizing pass when the page layou t 4648 // This is to allow for a fresh text autosizing pass when the page layou t
4649 // changes significantly in the end. 4649 // changes significantly in the end.
4650 if (TextAutosizer* textAutosizer = this->textAutosizer()) 4650 if (TextAutosizer* textAutosizer = this->textAutosizer())
4651 textAutosizer->recalculateMultipliers(); 4651 textAutosizer->recalculateMultipliers();
4652 } 4652 }
4653 4653
4654 // The loader's finishedParsing() method may invoke script that causes this object to 4654 // The loader's finishedParsing() method may invoke script that causes this object to
4655 // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change). 4655 // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change).
4656 // Keep it alive until we are done. 4656 // Keep it alive until we are done.
4657 RefPtr<Document> protect(this); 4657 RefPtrWillBeRawPtr<Document> protect(this);
4658 4658
4659 if (RefPtr<LocalFrame> f = frame()) { 4659 if (RefPtr<LocalFrame> f = frame()) {
4660 // Don't update the render tree if we haven't requested the main resourc e yet to avoid 4660 // Don't update the render tree if we haven't requested the main resourc e yet to avoid
4661 // adding extra latency. Note that the first render tree update can be e xpensive since it 4661 // adding extra latency. Note that the first render tree update can be e xpensive since it
4662 // triggers the parsing of the default stylesheets which are compiled-in . 4662 // triggers the parsing of the default stylesheets which are compiled-in .
4663 const bool mainResourceWasAlreadyRequested = 4663 const bool mainResourceWasAlreadyRequested =
4664 m_frame->loader().stateMachine()->committedFirstRealDocumentLoad(); 4664 m_frame->loader().stateMachine()->committedFirstRealDocumentLoad();
4665 4665
4666 // FrameLoader::finishedParsing() might end up calling Document::implici tClose() if all 4666 // FrameLoader::finishedParsing() might end up calling Document::implici tClose() if all
4667 // resource loads are complete. HTMLObjectElements can start loading the ir resources from 4667 // resource loads are complete. HTMLObjectElements can start loading the ir resources from
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
5823 visitor->trace(m_compositorPendingAnimations); 5823 visitor->trace(m_compositorPendingAnimations);
5824 visitor->trace(m_contextDocument); 5824 visitor->trace(m_contextDocument);
5825 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5825 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5826 DocumentSupplementable::trace(visitor); 5826 DocumentSupplementable::trace(visitor);
5827 TreeScope::trace(visitor); 5827 TreeScope::trace(visitor);
5828 ContainerNode::trace(visitor); 5828 ContainerNode::trace(visitor);
5829 ExecutionContext::trace(visitor); 5829 ExecutionContext::trace(visitor);
5830 } 5830 }
5831 5831
5832 } // namespace WebCore 5832 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698