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

Side by Side Diff: content/renderer/history_entry.cc

Issue 248013003: Remove WebHistoryItem child usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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 /* 5 /*
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 17 matching lines...) Expand all
28 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36 #include "content/renderer/history_entry.h" 36 #include "content/renderer/history_entry.h"
37 37
38 #include <deque>
39
40 #include "content/renderer/render_frame_impl.h" 38 #include "content/renderer/render_frame_impl.h"
41 #include "content/renderer/render_view_impl.h" 39 #include "content/renderer/render_view_impl.h"
42 #include "third_party/WebKit/public/web/WebFrame.h" 40 #include "third_party/WebKit/public/web/WebFrame.h"
43 41
44 using blink::WebFrame; 42 using blink::WebFrame;
45 using blink::WebHistoryItem; 43 using blink::WebHistoryItem;
46 44
47 namespace content { 45 namespace content {
48 46
49 HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::AddChild( 47 HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::AddChild(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 new_item, 81 new_item,
84 clone_children_of_target, 82 clone_children_of_target,
85 target_frame, 83 target_frame,
86 child_render_frame); 84 child_render_frame);
87 new_history_node->children_->push_back(new_child_node); 85 new_history_node->children_->push_back(new_child_node);
88 } 86 }
89 } 87 }
90 return new_history_node; 88 return new_history_node;
91 } 89 }
92 90
91 void HistoryEntry::HistoryNode::set_item(const WebHistoryItem& item) {
92 entry_->unique_names_to_items_[item.target().utf8()] = this;
Nate Chapin 2014/04/25 21:49:21 When a HistoryNode is created during deserializati
Charlie Reis 2014/04/28 16:29:00 I'm not sure I follow this, but it also sounds lik
Nate Chapin 2014/04/28 17:31:54 Done.
93 item_ = item;
94 }
95
93 HistoryEntry::HistoryNode::HistoryNode(HistoryEntry* entry, 96 HistoryEntry::HistoryNode::HistoryNode(HistoryEntry* entry,
94 const WebHistoryItem& item, 97 const WebHistoryItem& item,
95 int64_t frame_id) 98 int64_t frame_id)
96 : entry_(entry), item_(item) { 99 : entry_(entry), item_(item) {
97 if (frame_id != kInvalidFrameRoutingID) 100 if (frame_id != kInvalidFrameRoutingID)
98 entry_->frames_to_items_[frame_id] = this; 101 entry_->frames_to_items_[frame_id] = this;
99 entry_->unique_names_to_items_[item.target().utf8()] = this; 102 if (!item.isNull())
103 entry_->unique_names_to_items_[item.target().utf8()] = this;
100 children_.reset(new ScopedVector<HistoryNode>); 104 children_.reset(new ScopedVector<HistoryNode>);
101 } 105 }
102 106
103 HistoryEntry::HistoryNode::~HistoryNode() { 107 HistoryEntry::HistoryNode::~HistoryNode() {
104 } 108 }
105 109
106 void HistoryEntry::HistoryNode::RemoveChildren() { 110 void HistoryEntry::HistoryNode::RemoveChildren() {
107 // TODO(japhet): This is inefficient. Figure out a cleaner way to ensure 111 // TODO(japhet): This is inefficient. Figure out a cleaner way to ensure
108 // this HistoryNode isn't cached anywhere. 112 // this HistoryNode isn't cached anywhere.
109 std::vector<uint64_t> frames_to_remove; 113 std::vector<uint64_t> frames_to_remove;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return unique_names_to_items_[frame->GetWebFrame()->uniqueName().utf8()]; 172 return unique_names_to_items_[frame->GetWebFrame()->uniqueName().utf8()];
169 } 173 }
170 174
171 WebHistoryItem HistoryEntry::GetItemForFrame(RenderFrameImpl* frame) { 175 WebHistoryItem HistoryEntry::GetItemForFrame(RenderFrameImpl* frame) {
172 if (HistoryNode* history_node = GetHistoryNodeForFrame(frame)) 176 if (HistoryNode* history_node = GetHistoryNodeForFrame(frame))
173 return history_node->item(); 177 return history_node->item();
174 return WebHistoryItem(); 178 return WebHistoryItem();
175 } 179 }
176 180
177 } // namespace content 181 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698