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

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

Issue 2181753002: Simplify EncodePageState to return no value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « content/public/common/page_state.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/renderer/history_serialization.h" 5 #include "content/renderer/history_serialization.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/nullable_string16.h" 9 #include "base/strings/nullable_string16.h"
10 #include "content/child/web_url_request_util.h" 10 #include "content/child/web_url_request_util.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 } // namespace 117 } // namespace
118 118
119 PageState HistoryEntryToPageState(HistoryEntry* entry) { 119 PageState HistoryEntryToPageState(HistoryEntry* entry) {
120 ExplodedPageState state; 120 ExplodedPageState state;
121 RecursivelyGenerateFrameState(entry->root_history_node(), &state.top, 121 RecursivelyGenerateFrameState(entry->root_history_node(), &state.top,
122 &state.referenced_files); 122 &state.referenced_files);
123 123
124 std::string encoded_data; 124 std::string encoded_data;
125 if (!EncodePageState(state, &encoded_data)) 125 EncodePageState(state, &encoded_data);
126 return PageState();
127
128 return PageState::CreateFromEncodedData(encoded_data); 126 return PageState::CreateFromEncodedData(encoded_data);
129 } 127 }
130 128
131 PageState SingleHistoryItemToPageState(const WebHistoryItem& item) { 129 PageState SingleHistoryItemToPageState(const WebHistoryItem& item) {
132 ExplodedPageState state; 130 ExplodedPageState state;
133 ToNullableString16Vector(item.getReferencedFilePaths(), 131 ToNullableString16Vector(item.getReferencedFilePaths(),
134 &state.referenced_files); 132 &state.referenced_files);
135 GenerateFrameStateFromItem(item, &state.top); 133 GenerateFrameStateFromItem(item, &state.top);
136 134
137 std::string encoded_data; 135 std::string encoded_data;
138 if (!EncodePageState(state, &encoded_data)) 136 EncodePageState(state, &encoded_data);
139 return PageState();
140
141 return PageState::CreateFromEncodedData(encoded_data); 137 return PageState::CreateFromEncodedData(encoded_data);
142 } 138 }
143 139
144 std::unique_ptr<HistoryEntry> PageStateToHistoryEntry( 140 std::unique_ptr<HistoryEntry> PageStateToHistoryEntry(
145 const PageState& page_state) { 141 const PageState& page_state) {
146 ExplodedPageState state; 142 ExplodedPageState state;
147 if (!DecodePageState(page_state.ToEncodedData(), &state)) 143 if (!DecodePageState(page_state.ToEncodedData(), &state))
148 return std::unique_ptr<HistoryEntry>(); 144 return std::unique_ptr<HistoryEntry>();
149 145
150 std::unique_ptr<HistoryEntry> entry(new HistoryEntry()); 146 std::unique_ptr<HistoryEntry> entry(new HistoryEntry());
151 RecursivelyGenerateHistoryItem(state.top, entry->root_history_node()); 147 RecursivelyGenerateHistoryItem(state.top, entry->root_history_node());
152 148
153 return entry; 149 return entry;
154 } 150 }
155 151
156 } // namespace content 152 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/page_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698