Chromium Code Reviews| 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; |