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

Side by Side Diff: third_party/WebKit/Source/web/WebFrame.cpp

Issue 1839643009: RELEASE_ASSERT -> CHECK and ASSERT -> DCHECK in web. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Return DCHECK_IS_ON checks. Created 4 years, 8 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "public/web/WebFrame.h" 5 #include "public/web/WebFrame.h"
6 6
7 #include "bindings/core/v8/WindowProxyManager.h" 7 #include "bindings/core/v8/WindowProxyManager.h"
8 #include "core/frame/FrameHost.h" 8 #include "core/frame/FrameHost.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // FIXME: This is a bit clunky; this results in pointless decrements and 93 // FIXME: This is a bit clunky; this results in pointless decrements and
94 // increments of connected subframes. 94 // increments of connected subframes.
95 if (frame->isWebLocalFrame()) { 95 if (frame->isWebLocalFrame()) {
96 // TODO(dcheng): in an ideal world, both branches would just use 96 // TODO(dcheng): in an ideal world, both branches would just use
97 // WebFrameImplBase's initializeCoreFrame() helper. However, Blink 97 // WebFrameImplBase's initializeCoreFrame() helper. However, Blink
98 // currently requires a 'provisional' local frame to serve as a 98 // currently requires a 'provisional' local frame to serve as a
99 // placeholder for loading state when swapping to a local frame. 99 // placeholder for loading state when swapping to a local frame.
100 // In this case, the core LocalFrame is already initialized, so just 100 // In this case, the core LocalFrame is already initialized, so just
101 // update a bit of state. 101 // update a bit of state.
102 LocalFrame& localFrame = *toWebLocalFrameImpl(frame)->frame(); 102 LocalFrame& localFrame = *toWebLocalFrameImpl(frame)->frame();
103 ASSERT(owner == localFrame.owner()); 103 DCHECK_EQ(owner, localFrame.owner());
104 if (owner) { 104 if (owner) {
105 owner->setContentFrame(localFrame); 105 owner->setContentFrame(localFrame);
106 if (owner->isLocal()) 106 if (owner->isLocal())
107 toHTMLFrameOwnerElement(owner)->setWidget(localFrame.view()); 107 toHTMLFrameOwnerElement(owner)->setWidget(localFrame.view());
108 } else { 108 } else {
109 localFrame.page()->setMainFrame(&localFrame); 109 localFrame.page()->setMainFrame(&localFrame);
110 } 110 }
111 } else { 111 } else {
112 toWebRemoteFrameImpl(frame)->initializeCoreFrame(host, owner, name, uniq ueName); 112 toWebRemoteFrameImpl(frame)->initializeCoreFrame(host, owner, name, uniq ueName);
113 } 113 }
(...skipping 14 matching lines...) Expand all
128 { 128 {
129 return WebSecurityOrigin(toImplBase()->frame()->securityContext()->getSecuri tyOrigin()); 129 return WebSecurityOrigin(toImplBase()->frame()->securityContext()->getSecuri tyOrigin());
130 } 130 }
131 131
132 132
133 void WebFrame::setFrameOwnerSandboxFlags(WebSandboxFlags flags) 133 void WebFrame::setFrameOwnerSandboxFlags(WebSandboxFlags flags)
134 { 134 {
135 // At the moment, this is only used to replicate sandbox flags 135 // At the moment, this is only used to replicate sandbox flags
136 // for frames with a remote owner. 136 // for frames with a remote owner.
137 FrameOwner* owner = toImplBase()->frame()->owner(); 137 FrameOwner* owner = toImplBase()->frame()->owner();
138 ASSERT(owner); 138 DCHECK(owner);
139 toRemoteFrameOwner(owner)->setSandboxFlags(static_cast<SandboxFlags>(flags)) ; 139 toRemoteFrameOwner(owner)->setSandboxFlags(static_cast<SandboxFlags>(flags)) ;
140 } 140 }
141 141
142 bool WebFrame::shouldEnforceStrictMixedContentChecking() const 142 bool WebFrame::shouldEnforceStrictMixedContentChecking() const
143 { 143 {
144 return toImplBase()->frame()->securityContext()->shouldEnforceStrictMixedCon tentChecking(); 144 return toImplBase()->frame()->securityContext()->shouldEnforceStrictMixedCon tentChecking();
145 } 145 }
146 146
147 WebFrame* WebFrame::opener() const 147 WebFrame* WebFrame::opener() const
148 { 148 {
(...skipping 12 matching lines...) Expand all
161 void WebFrame::insertAfter(WebFrame* newChild, WebFrame* previousSibling) 161 void WebFrame::insertAfter(WebFrame* newChild, WebFrame* previousSibling)
162 { 162 {
163 newChild->m_parent = this; 163 newChild->m_parent = this;
164 164
165 WebFrame* next; 165 WebFrame* next;
166 if (!previousSibling) { 166 if (!previousSibling) {
167 // Insert at the beginning if no previous sibling is specified. 167 // Insert at the beginning if no previous sibling is specified.
168 next = m_firstChild; 168 next = m_firstChild;
169 m_firstChild = newChild; 169 m_firstChild = newChild;
170 } else { 170 } else {
171 ASSERT(previousSibling->m_parent == this); 171 DCHECK_EQ(previousSibling->m_parent, this);
172 next = previousSibling->m_nextSibling; 172 next = previousSibling->m_nextSibling;
173 previousSibling->m_nextSibling = newChild; 173 previousSibling->m_nextSibling = newChild;
174 newChild->m_previousSibling = previousSibling; 174 newChild->m_previousSibling = previousSibling;
175 } 175 }
176 176
177 if (next) { 177 if (next) {
178 newChild->m_nextSibling = next; 178 newChild->m_nextSibling = next;
179 next->m_previousSibling = newChild; 179 next->m_previousSibling = newChild;
180 } else { 180 } else {
181 m_lastChild = newChild; 181 m_lastChild = newChild;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 337
338 if (frame->isWebLocalFrame()) 338 if (frame->isWebLocalFrame())
339 visitor->trace(toWebLocalFrameImpl(frame)); 339 visitor->trace(toWebLocalFrameImpl(frame));
340 else 340 else
341 visitor->trace(toWebRemoteFrameImpl(frame)); 341 visitor->trace(toWebRemoteFrameImpl(frame));
342 } 342 }
343 343
344 template <typename VisitorDispatcher> 344 template <typename VisitorDispatcher>
345 ALWAYS_INLINE void WebFrame::traceFramesImpl(VisitorDispatcher visitor, WebFrame * frame) 345 ALWAYS_INLINE void WebFrame::traceFramesImpl(VisitorDispatcher visitor, WebFrame * frame)
346 { 346 {
347 ASSERT(frame); 347 DCHECK(frame);
348 traceFrame(visitor, frame->m_parent); 348 traceFrame(visitor, frame->m_parent);
349 for (WebFrame* child = frame->firstChild(); child; child = child->nextSiblin g()) 349 for (WebFrame* child = frame->firstChild(); child; child = child->nextSiblin g())
350 traceFrame(visitor, child); 350 traceFrame(visitor, child);
351 // m_opener is a weak reference. 351 // m_opener is a weak reference.
352 frame->m_openedFrameTracker->traceFrames(visitor); 352 frame->m_openedFrameTracker->traceFrames(visitor);
353 } 353 }
354 354
355 template <typename VisitorDispatcher> 355 template <typename VisitorDispatcher>
356 ALWAYS_INLINE void WebFrame::clearWeakFramesImpl(VisitorDispatcher visitor) 356 ALWAYS_INLINE void WebFrame::clearWeakFramesImpl(VisitorDispatcher visitor)
357 { 357 {
358 if (!isFrameAlive(m_opener)) 358 if (!isFrameAlive(m_opener))
359 m_opener = nullptr; 359 m_opener = nullptr;
360 } 360 }
361 361
362 #define DEFINE_VISITOR_METHOD(VisitorDispatcher) \ 362 #define DEFINE_VISITOR_METHOD(VisitorDispatcher) \
363 void WebFrame::traceFrame(VisitorDispatcher visitor, WebFrame* frame) { trac eFrameImpl(visitor, frame); } \ 363 void WebFrame::traceFrame(VisitorDispatcher visitor, WebFrame* frame) { trac eFrameImpl(visitor, frame); } \
364 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra ceFramesImpl(visitor, frame); } \ 364 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra ceFramesImpl(visitor, frame); } \
365 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI mpl(visitor); } 365 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI mpl(visitor); }
366 366
367 DEFINE_VISITOR_METHOD(Visitor*) 367 DEFINE_VISITOR_METHOD(Visitor*)
368 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) 368 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor)
369 369
370 #undef DEFINE_VISITOR_METHOD 370 #undef DEFINE_VISITOR_METHOD
371 #endif 371 #endif
372 372
373 } // namespace blink 373 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebEntities.cpp ('k') | third_party/WebKit/Source/web/WebFrameSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698