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

Side by Side Diff: third_party/WebKit/Source/core/page/FrameTree.cpp

Issue 2849403002: Use const ref for LocalFrame::LocalFrameRoot and FrameTree::Top (Closed)
Patch Set: fix compile and dchecks Created 3 years, 7 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) 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 name_ = name; 68 name_ = name;
69 } 69 }
70 70
71 DISABLE_CFI_PERF 71 DISABLE_CFI_PERF
72 Frame* FrameTree::Parent() const { 72 Frame* FrameTree::Parent() const {
73 if (!this_frame_->Client()) 73 if (!this_frame_->Client())
74 return nullptr; 74 return nullptr;
75 return this_frame_->Client()->Parent(); 75 return this_frame_->Client()->Parent();
76 } 76 }
77 77
78 Frame* FrameTree::Top() const { 78 Frame& FrameTree::Top() const {
79 // FIXME: top() should never return null, so here are some hacks to deal 79 // FIXME: top() should never return null, so here are some hacks to deal
80 // with EmptyLocalFrameClient and cases where the frame is detached 80 // with EmptyLocalFrameClient and cases where the frame is detached
81 // already... 81 // already...
82 if (!this_frame_->Client()) 82 if (!this_frame_->Client())
83 return this_frame_; 83 return *this_frame_;
84 Frame* candidate = this_frame_->Client()->Top(); 84 Frame* candidate = this_frame_->Client()->Top();
85 return candidate ? candidate : this_frame_.Get(); 85 return candidate ? *candidate : *this_frame_;
86 } 86 }
87 87
88 Frame* FrameTree::NextSibling() const { 88 Frame* FrameTree::NextSibling() const {
89 if (!this_frame_->Client()) 89 if (!this_frame_->Client())
90 return nullptr; 90 return nullptr;
91 return this_frame_->Client()->NextSibling(); 91 return this_frame_->Client()->NextSibling();
92 } 92 }
93 93
94 Frame* FrameTree::FirstChild() const { 94 Frame* FrameTree::FirstChild() const {
95 if (!this_frame_->Client()) 95 if (!this_frame_->Client())
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 ++count; 147 ++count;
148 return count; 148 return count;
149 } 149 }
150 150
151 Frame* FrameTree::Find(const AtomicString& name) const { 151 Frame* FrameTree::Find(const AtomicString& name) const {
152 if (EqualIgnoringASCIICase(name, "_self") || 152 if (EqualIgnoringASCIICase(name, "_self") ||
153 EqualIgnoringASCIICase(name, "_current") || name.IsEmpty()) 153 EqualIgnoringASCIICase(name, "_current") || name.IsEmpty())
154 return this_frame_; 154 return this_frame_;
155 155
156 if (EqualIgnoringASCIICase(name, "_top")) 156 if (EqualIgnoringASCIICase(name, "_top"))
157 return Top(); 157 return &Top();
158 158
159 if (EqualIgnoringASCIICase(name, "_parent")) 159 if (EqualIgnoringASCIICase(name, "_parent"))
160 return Parent() ? Parent() : this_frame_.Get(); 160 return Parent() ? Parent() : this_frame_.Get();
161 161
162 // Since "_blank" should never be any frame's name, the following just amounts 162 // Since "_blank" should never be any frame's name, the following just amounts
163 // to an optimization. 163 // to an optimization.
164 if (EqualIgnoringASCIICase(name, "_blank")) 164 if (EqualIgnoringASCIICase(name, "_blank"))
165 return nullptr; 165 return nullptr;
166 166
167 // Search subtree starting with this frame first. 167 // Search subtree starting with this frame first.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 child = child->Tree().NextSibling()) 292 child = child->Tree().NextSibling())
293 printFrames(child, targetFrame, indent + 1); 293 printFrames(child, targetFrame, indent + 1);
294 } 294 }
295 295
296 void showFrameTree(const blink::Frame* frame) { 296 void showFrameTree(const blink::Frame* frame) {
297 if (!frame) { 297 if (!frame) {
298 printf("Null input frame\n"); 298 printf("Null input frame\n");
299 return; 299 return;
300 } 300 }
301 301
302 printFrames(frame->Tree().Top(), frame, 0); 302 printFrames(&frame->Tree().Top(), frame, 0);
303 } 303 }
304 304
305 #endif 305 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/FrameTree.h ('k') | third_party/WebKit/Source/core/timing/Performance.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698