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

Side by Side Diff: content/browser/frame_host/navigation_entry_impl.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 | « no previous file | content/common/page_state_serialization.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/frame_host/navigation_entry_impl.h" 5 #include "content/browser/frame_host/navigation_entry_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 UTF16ToUTF8(state.target.string()), state.item_sequence_number, 44 UTF16ToUTF8(state.target.string()), state.item_sequence_number,
45 state.document_sequence_number, nullptr, nullptr, 45 state.document_sequence_number, nullptr, nullptr,
46 GURL(state.url_string.string()), 46 GURL(state.url_string.string()),
47 Referrer(GURL(state.referrer.string()), state.referrer_policy), "GET", 47 Referrer(GURL(state.referrer.string()), state.referrer_policy), "GET",
48 -1); 48 -1);
49 49
50 // Set a single-frame PageState on the entry. 50 // Set a single-frame PageState on the entry.
51 ExplodedPageState page_state; 51 ExplodedPageState page_state;
52 page_state.top = state; 52 page_state.top = state;
53 std::string data; 53 std::string data;
54 if (EncodePageState(page_state, &data)) 54 EncodePageState(page_state, &data);
55 node->frame_entry->set_page_state(PageState::CreateFromEncodedData(data)); 55 node->frame_entry->set_page_state(PageState::CreateFromEncodedData(data));
56 56
57 for (const ExplodedFrameState& child_state : state.children) { 57 for (const ExplodedFrameState& child_state : state.children) {
58 NavigationEntryImpl::TreeNode* child_node = 58 NavigationEntryImpl::TreeNode* child_node =
59 new NavigationEntryImpl::TreeNode(nullptr); 59 new NavigationEntryImpl::TreeNode(nullptr);
60 node->children.push_back(child_node); 60 node->children.push_back(child_node);
61 RecursivelyGenerateFrameEntries(child_state, child_node); 61 RecursivelyGenerateFrameEntries(child_state, child_node);
62 } 62 }
63 } 63 }
64 64
65 void RecursivelyGenerateFrameState( 65 void RecursivelyGenerateFrameState(
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 return frame_tree_->frame_entry->page_state(); 310 return frame_tree_->frame_entry->page_state();
311 311
312 // When we're using subframe entries, each FrameNavigationEntry has a 312 // When we're using subframe entries, each FrameNavigationEntry has a
313 // frame-specific PageState. We combine these into an ExplodedPageState tree 313 // frame-specific PageState. We combine these into an ExplodedPageState tree
314 // and generate a full PageState from it. 314 // and generate a full PageState from it.
315 ExplodedPageState exploded_state; 315 ExplodedPageState exploded_state;
316 RecursivelyGenerateFrameState(frame_tree_.get(), &exploded_state.top, 316 RecursivelyGenerateFrameState(frame_tree_.get(), &exploded_state.top,
317 &exploded_state.referenced_files); 317 &exploded_state.referenced_files);
318 318
319 std::string encoded_data; 319 std::string encoded_data;
320 if (!EncodePageState(exploded_state, &encoded_data)) 320 EncodePageState(exploded_state, &encoded_data);
321 return frame_tree_->frame_entry->page_state();
322
323 return PageState::CreateFromEncodedData(encoded_data); 321 return PageState::CreateFromEncodedData(encoded_data);
324 } 322 }
325 323
326 void NavigationEntryImpl::SetPageID(int page_id) { 324 void NavigationEntryImpl::SetPageID(int page_id) {
327 page_id_ = page_id; 325 page_id_ = page_id;
328 } 326 }
329 327
330 int32_t NavigationEntryImpl::GetPageID() const { 328 int32_t NavigationEntryImpl::GetPageID() const {
331 return page_id_; 329 return page_id_;
332 } 330 }
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 return node; 774 return node;
777 775
778 // Enqueue any children and keep looking. 776 // Enqueue any children and keep looking.
779 for (auto& child : node->children) 777 for (auto& child : node->children)
780 work_queue.push(child); 778 work_queue.push(child);
781 } 779 }
782 return nullptr; 780 return nullptr;
783 } 781 }
784 782
785 } // namespace content 783 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/page_state_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698