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

Unified Diff: components/sessions/core/serialized_navigation_entry.cc

Issue 2310363002: Persist offline page info in a navigation entry if needed (Closed)
Patch Set: Fix win compiling error due to using unique_ptr map in SESSIONS_EXPORT class Created 4 years, 3 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
Index: components/sessions/core/serialized_navigation_entry.cc
diff --git a/components/sessions/core/serialized_navigation_entry.cc b/components/sessions/core/serialized_navigation_entry.cc
index 4f4124c598a5e7c50be2ed812a71946ec0aa6b33..08685eb36021a03d8ca5a10c96d00e145d5c45fb 100644
--- a/components/sessions/core/serialized_navigation_entry.cc
+++ b/components/sessions/core/serialized_navigation_entry.cc
@@ -213,6 +213,7 @@ enum TypeMask {
// search_terms_
// http_status_code_
// referrer_policy_
+// extended_info_map_
void SerializedNavigationEntry::WriteToPickle(int max_size,
base::Pickle* pickle) const {
@@ -257,6 +258,12 @@ void SerializedNavigationEntry::WriteToPickle(int max_size,
pickle->WriteInt(http_status_code_);
pickle->WriteInt(referrer_policy_);
+
+ pickle->WriteInt(extended_info_map_.size());
+ for (const auto entry : extended_info_map_) {
+ WriteStringToPickle(pickle, &bytes_written, max_size, entry.first);
+ WriteStringToPickle(pickle, &bytes_written, max_size, entry.second);
+ }
}
bool SerializedNavigationEntry::ReadFromPickle(base::PickleIterator* iterator) {
@@ -335,6 +342,17 @@ bool SerializedNavigationEntry::ReadFromPickle(base::PickleIterator* iterator) {
SerializedNavigationDriver::Get()->StripReferrerFromPageState(
encoded_page_state_);
}
+
+ int extended_info_map_size = 0;
+ if (iterator->ReadInt(&extended_info_map_size) &&
+ extended_info_map_size > 0) {
+ for (int i = 0; i < extended_info_map_size; ++i) {
+ std::string key;
+ std::string value;
+ if (iterator->ReadString(&key) && iterator->ReadString(&value))
+ extended_info_map_[key] = value;
+ }
+ }
}
SerializedNavigationDriver::Get()->Sanitize(this);

Powered by Google App Engine
This is Rietveld 408576698