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

Unified Diff: content/renderer/history_entry.cc

Issue 248013003: Remove WebHistoryItem child usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar comments Created 6 years, 8 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 | « content/renderer/history_entry.h ('k') | content/renderer/history_serialization.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/history_entry.cc
diff --git a/content/renderer/history_entry.cc b/content/renderer/history_entry.cc
index 8d168ee5d3a4df9e88d1ec3a1cecd3c308a741ff..63c1ea0f1d3d588bde9a13ecb150b71065a2f955 100644
--- a/content/renderer/history_entry.cc
+++ b/content/renderer/history_entry.cc
@@ -35,8 +35,6 @@
#include "content/renderer/history_entry.h"
-#include <deque>
-
#include "content/renderer/render_frame_impl.h"
#include "content/renderer/render_view_impl.h"
#include "third_party/WebKit/public/web/WebFrame.h"
@@ -53,6 +51,10 @@ HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::AddChild(
return children_->back();
}
+HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::AddChild() {
+ return AddChild(WebHistoryItem(), kInvalidFrameRoutingID);
+}
+
HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::CloneAndReplace(
HistoryEntry* new_entry,
const WebHistoryItem& new_item,
@@ -90,13 +92,21 @@ HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::CloneAndReplace(
return new_history_node;
}
+void HistoryEntry::HistoryNode::set_item(const WebHistoryItem& item) {
+ // The previous HistoryItem might not have had a target set, or it might be
+ // different than the current one.
+ entry_->unique_names_to_items_[item.target().utf8()] = this;
+ item_ = item;
+}
+
HistoryEntry::HistoryNode::HistoryNode(HistoryEntry* entry,
const WebHistoryItem& item,
int64_t frame_id)
: entry_(entry), item_(item) {
if (frame_id != kInvalidFrameRoutingID)
entry_->frames_to_items_[frame_id] = this;
- entry_->unique_names_to_items_[item.target().utf8()] = this;
+ if (!item.isNull())
+ entry_->unique_names_to_items_[item.target().utf8()] = this;
children_.reset(new ScopedVector<HistoryNode>);
}
@@ -138,6 +148,7 @@ void HistoryEntry::HistoryNode::RemoveChildren() {
}
HistoryEntry::HistoryEntry() {
+ root_.reset(new HistoryNode(this, WebHistoryItem(), kInvalidFrameRoutingID));
}
HistoryEntry::~HistoryEntry() {
« no previous file with comments | « content/renderer/history_entry.h ('k') | content/renderer/history_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698