OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 , m_scopedChildCount(invalidChildCount) | 47 , m_scopedChildCount(invalidChildCount) |
48 { | 48 { |
49 } | 49 } |
50 | 50 |
51 FrameTree::~FrameTree() | 51 FrameTree::~FrameTree() |
52 { | 52 { |
53 } | 53 } |
54 | 54 |
55 void FrameTree::setName(const AtomicString& name) | 55 void FrameTree::setName(const AtomicString& name) |
56 { | 56 { |
| 57 // Do not recalculate m_uniqueName if there is no real change of m_name. |
| 58 // This is not just a performance optimization - other code relies on the |
| 59 // assumption that unique name shouldn't change if the assigned name didn't |
| 60 // change (i.e. code in content::FrameTreeNode::SetFrameName). |
| 61 if (m_name == name) { |
| 62 // Assert that returning early below won't leave m_uniqueName in an |
| 63 // uninitialized state - it should only be null if m_name is also |
| 64 // null and only if it is for the main frame. |
| 65 // m_uniqueName.isNull() should imply m_name.isNull() && !parent(). |
| 66 // this FrameTree is for a main frame. |
| 67 DCHECK(!m_uniqueName.isNull() || (m_name.isNull() && !parent())); |
| 68 return; |
| 69 } |
| 70 |
57 m_name = name; | 71 m_name = name; |
58 | 72 |
59 // Remove our old frame name so it's not considered in calculateUniqueNameFo
rChildFrame | 73 // Remove our old frame name so it's not considered in calculateUniqueNameFo
rChildFrame |
60 // and appendUniqueSuffix calls below. | 74 // and appendUniqueSuffix calls below. |
61 m_uniqueName = AtomicString(); | 75 m_uniqueName = AtomicString(); |
62 | 76 |
63 // Calculate a new unique name based on inputs. | 77 // Calculate a new unique name based on inputs. |
64 if (parent()) { | 78 if (parent()) { |
65 setUniqueName( | 79 setUniqueName( |
66 parent()->tree().calculateUniqueNameForChildFrame(m_thisFrame, name,
nullAtom)); | 80 parent()->tree().calculateUniqueNameForChildFrame(m_thisFrame, name,
nullAtom)); |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 { | 591 { |
578 if (!frame) { | 592 if (!frame) { |
579 printf("Null input frame\n"); | 593 printf("Null input frame\n"); |
580 return; | 594 return; |
581 } | 595 } |
582 | 596 |
583 printFrames(frame->tree().top(), frame, 0); | 597 printFrames(frame->tree().top(), frame, 0); |
584 } | 598 } |
585 | 599 |
586 #endif | 600 #endif |
OLD | NEW |