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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2151933003: Change WTF::TemporaryChange to be an alias for AutoReset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TemporaryChange -> AutoReset Created 4 years, 5 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 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #include "platform/TraceEvent.h" 89 #include "platform/TraceEvent.h"
90 #include "platform/UserGestureIndicator.h" 90 #include "platform/UserGestureIndicator.h"
91 #include "platform/network/HTTPParsers.h" 91 #include "platform/network/HTTPParsers.h"
92 #include "platform/network/ResourceRequest.h" 92 #include "platform/network/ResourceRequest.h"
93 #include "platform/scroll/ScrollAnimatorBase.h" 93 #include "platform/scroll/ScrollAnimatorBase.h"
94 #include "platform/weborigin/SecurityOrigin.h" 94 #include "platform/weborigin/SecurityOrigin.h"
95 #include "platform/weborigin/SecurityPolicy.h" 95 #include "platform/weborigin/SecurityPolicy.h"
96 #include "platform/weborigin/Suborigin.h" 96 #include "platform/weborigin/Suborigin.h"
97 #include "public/platform/WebCachePolicy.h" 97 #include "public/platform/WebCachePolicy.h"
98 #include "public/platform/WebURLRequest.h" 98 #include "public/platform/WebURLRequest.h"
99 #include "wtf/TemporaryChange.h" 99 #include "wtf/AutoReset.h"
100 #include "wtf/text/CString.h" 100 #include "wtf/text/CString.h"
101 #include "wtf/text/WTFString.h" 101 #include "wtf/text/WTFString.h"
102 #include <memory> 102 #include <memory>
103 103
104 using blink::WebURLRequest; 104 using blink::WebURLRequest;
105 105
106 namespace blink { 106 namespace blink {
107 107
108 using namespace HTMLNames; 108 using namespace HTMLNames;
109 109
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 737
738 void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip tValue> stateObject, FrameLoadType frameLoadType, HistoryLoadType historyLoadTyp e, ClientRedirectPolicy clientRedirect, Document* initiatingDocument) 738 void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip tValue> stateObject, FrameLoadType frameLoadType, HistoryLoadType historyLoadTyp e, ClientRedirectPolicy clientRedirect, Document* initiatingDocument)
739 { 739 {
740 // If we have a state object, we cannot also be a new navigation. 740 // If we have a state object, we cannot also be a new navigation.
741 ASSERT(!stateObject || frameLoadType == FrameLoadTypeBackForward); 741 ASSERT(!stateObject || frameLoadType == FrameLoadTypeBackForward);
742 742
743 // If we have a provisional request for a different document, a fragment scr oll should cancel it. 743 // If we have a provisional request for a different document, a fragment scr oll should cancel it.
744 detachDocumentLoader(m_provisionalDocumentLoader); 744 detachDocumentLoader(m_provisionalDocumentLoader);
745 if (!m_frame->host()) 745 if (!m_frame->host())
746 return; 746 return;
747 TemporaryChange<FrameLoadType> loadTypeChange(m_loadType, frameLoadType); 747 AutoReset<FrameLoadType> loadTypeChange(&m_loadType, frameLoadType);
748 saveScrollState(); 748 saveScrollState();
749 749
750 KURL oldURL = m_frame->document()->url(); 750 KURL oldURL = m_frame->document()->url();
751 bool hashChange = equalIgnoringFragmentIdentifier(url, oldURL) && url.fragme ntIdentifier() != oldURL.fragmentIdentifier(); 751 bool hashChange = equalIgnoringFragmentIdentifier(url, oldURL) && url.fragme ntIdentifier() != oldURL.fragmentIdentifier();
752 if (hashChange) { 752 if (hashChange) {
753 // If we were in the autoscroll/panScroll mode we want to stop it before following the link to the anchor 753 // If we were in the autoscroll/panScroll mode we want to stop it before following the link to the anchor
754 m_frame->eventHandler().stopAutoscroll(); 754 m_frame->eventHandler().stopAutoscroll();
755 m_frame->localDOMWindow()->enqueueHashchangeEvent(oldURL, url); 755 m_frame->localDOMWindow()->enqueueHashchangeEvent(oldURL, url);
756 } 756 }
757 m_documentLoader->setIsClientRedirect(clientRedirect == ClientRedirectPolicy ::ClientRedirect); 757 m_documentLoader->setIsClientRedirect(clientRedirect == ClientRedirectPolicy ::ClientRedirect);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 // script intiates a new load or causes the current frame to be detached, 1112 // script intiates a new load or causes the current frame to be detached,
1113 // we need to abandon the current load. 1113 // we need to abandon the current load.
1114 if (pdl != m_provisionalDocumentLoader) 1114 if (pdl != m_provisionalDocumentLoader)
1115 return false; 1115 return false;
1116 // detachFromFrame() will abort XHRs that haven't completed, which can 1116 // detachFromFrame() will abort XHRs that haven't completed, which can
1117 // trigger event listeners for 'abort'. These event listeners might call 1117 // trigger event listeners for 'abort'. These event listeners might call
1118 // window.stop(), which will in turn detach the provisional document loader. 1118 // window.stop(), which will in turn detach the provisional document loader.
1119 // At this point, the provisional document loader should not detach, because 1119 // At this point, the provisional document loader should not detach, because
1120 // then the FrameLoader would not have any attached DocumentLoaders. 1120 // then the FrameLoader would not have any attached DocumentLoaders.
1121 if (m_documentLoader) { 1121 if (m_documentLoader) {
1122 TemporaryChange<bool> inDetachDocumentLoader(m_protectProvisionalLoader, true); 1122 AutoReset<bool> inDetachDocumentLoader(&m_protectProvisionalLoader, true );
1123 detachDocumentLoader(m_documentLoader); 1123 detachDocumentLoader(m_documentLoader);
1124 } 1124 }
1125 // 'abort' listeners can also detach the frame. 1125 // 'abort' listeners can also detach the frame.
1126 if (!m_frame->client()) 1126 if (!m_frame->client())
1127 return false; 1127 return false;
1128 ASSERT(m_provisionalDocumentLoader == pdl); 1128 ASSERT(m_provisionalDocumentLoader == pdl);
1129 // No more events will be dispatched so detach the Document. 1129 // No more events will be dispatched so detach the Document.
1130 // TODO(yoav): Should we also be nullifying domWindow's document (or domWind ow) since the doc is now detached? 1130 // TODO(yoav): Should we also be nullifying domWindow's document (or domWind ow) since the doc is now detached?
1131 if (m_frame->document()) 1131 if (m_frame->document())
1132 m_frame->document()->detach(); 1132 m_frame->document()->detach();
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) 1542 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
1543 return; 1543 return;
1544 1544
1545 Settings* settings = m_frame->settings(); 1545 Settings* settings = m_frame->settings();
1546 if (settings && settings->forceMainWorldInitialization()) 1546 if (settings && settings->forceMainWorldInitialization())
1547 m_frame->script().initializeMainWorld(); 1547 m_frame->script().initializeMainWorld();
1548 InspectorInstrumentation::didClearDocumentOfWindowObject(m_frame); 1548 InspectorInstrumentation::didClearDocumentOfWindowObject(m_frame);
1549 1549
1550 if (m_dispatchingDidClearWindowObjectInMainWorld) 1550 if (m_dispatchingDidClearWindowObjectInMainWorld)
1551 return; 1551 return;
1552 TemporaryChange<bool> 1552 AutoReset<bool>
1553 inDidClearWindowObject(m_dispatchingDidClearWindowObjectInMainWorld, tru e); 1553 inDidClearWindowObject(&m_dispatchingDidClearWindowObjectInMainWorld, tr ue);
1554 // We just cleared the document, not the entire window object, but for the 1554 // We just cleared the document, not the entire window object, but for the
1555 // embedder that's close enough. 1555 // embedder that's close enough.
1556 client()->dispatchDidClearWindowObjectInMainWorld(); 1556 client()->dispatchDidClearWindowObjectInMainWorld();
1557 } 1557 }
1558 1558
1559 void FrameLoader::dispatchDidClearWindowObjectInMainWorld() 1559 void FrameLoader::dispatchDidClearWindowObjectInMainWorld()
1560 { 1560 {
1561 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) 1561 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
1562 return; 1562 return;
1563 1563
1564 if (m_dispatchingDidClearWindowObjectInMainWorld) 1564 if (m_dispatchingDidClearWindowObjectInMainWorld)
1565 return; 1565 return;
1566 TemporaryChange<bool> 1566 AutoReset<bool>
1567 inDidClearWindowObject(m_dispatchingDidClearWindowObjectInMainWorld, tru e); 1567 inDidClearWindowObject(&m_dispatchingDidClearWindowObjectInMainWorld, tr ue);
1568 client()->dispatchDidClearWindowObjectInMainWorld(); 1568 client()->dispatchDidClearWindowObjectInMainWorld();
1569 } 1569 }
1570 1570
1571 SandboxFlags FrameLoader::effectiveSandboxFlags() const 1571 SandboxFlags FrameLoader::effectiveSandboxFlags() const
1572 { 1572 {
1573 SandboxFlags flags = m_forcedSandboxFlags; 1573 SandboxFlags flags = m_forcedSandboxFlags;
1574 if (FrameOwner* frameOwner = m_frame->owner()) 1574 if (FrameOwner* frameOwner = m_frame->owner())
1575 flags |= frameOwner->getSandboxFlags(); 1575 flags |= frameOwner->getSandboxFlags();
1576 // Frames need to inherit the sandbox flags of their parent frame. 1576 // Frames need to inherit the sandbox flags of their parent frame.
1577 if (Frame* parentFrame = m_frame->tree().parent()) 1577 if (Frame* parentFrame = m_frame->tree().parent())
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String()); 1616 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String());
1617 return tracedValue; 1617 return tracedValue;
1618 } 1618 }
1619 1619
1620 inline void FrameLoader::takeObjectSnapshot() const 1620 inline void FrameLoader::takeObjectSnapshot() const
1621 { 1621 {
1622 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value()); 1622 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value());
1623 } 1623 }
1624 1624
1625 } // namespace blink 1625 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.cpp ('k') | third_party/WebKit/Source/core/page/PageAnimator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698