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

Unified Diff: third_party/WebKit/Source/core/page/FrameTree.cpp

Issue 2078643002: More aggressive DCHECKs for FrameTree::setName. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/page/FrameTree.cpp
diff --git a/third_party/WebKit/Source/core/page/FrameTree.cpp b/third_party/WebKit/Source/core/page/FrameTree.cpp
index 4b6e9d17b45d0d3ea6719c58cd470ee2c0147b38..5742191df101fb60dd771901f535fb76bb6c1d27 100644
--- a/third_party/WebKit/Source/core/page/FrameTree.cpp
+++ b/third_party/WebKit/Source/core/page/FrameTree.cpp
@@ -54,19 +54,22 @@ FrameTree::~FrameTree()
void FrameTree::setName(const AtomicString& name)
{
+ // This method should only be called for local frames
+ // (remote frames should be updated via setPrecalculatedName).
+ DCHECK(m_thisFrame->isLocalFrame());
+
+ // When this method is called, m_uniqueName should be already initialized.
+ // This assert helps ensure that early return (a few lines below) won't
+ // result in an uninitialized m_uniqueName.
+ DCHECK(!m_uniqueName.isNull()
+ || (m_uniqueName.isNull() && m_name.isNull() && !parent()));
Łukasz Anforowicz 2016/06/16 22:11:38 I think it is important to move this DCHECK out of
+
// Do not recalculate m_uniqueName if there is no real change of m_name.
// This is not just a performance optimization - other code relies on the
// assumption that unique name shouldn't change if the assigned name didn't
// change (i.e. code in content::FrameTreeNode::SetFrameName).
- if (m_name == name) {
- // Assert that returning early below won't leave m_uniqueName in an
- // uninitialized state - it should only be null if m_name is also
- // null and only if it is for the main frame.
- // m_uniqueName.isNull() should imply m_name.isNull() && !parent().
- // this FrameTree is for a main frame.
- DCHECK(!m_uniqueName.isNull() || (m_name.isNull() && !parent()));
+ if (m_name == name)
return;
- }
m_name = name;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698