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

Side by Side Diff: content/common/page_state_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, 5 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
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/common/page_state_serialization.h" 5 #include "content/common/page_state_serialization.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 *exploded = ExplodedPageState(); 734 *exploded = ExplodedPageState();
735 735
736 if (encoded.empty()) 736 if (encoded.empty())
737 return true; 737 return true;
738 738
739 SerializeObject obj(encoded.data(), static_cast<int>(encoded.size())); 739 SerializeObject obj(encoded.data(), static_cast<int>(encoded.size()));
740 ReadPageState(&obj, exploded); 740 ReadPageState(&obj, exploded);
741 return !obj.parse_error; 741 return !obj.parse_error;
742 } 742 }
743 743
744 bool EncodePageState(const ExplodedPageState& exploded, std::string* encoded) { 744 void EncodePageState(const ExplodedPageState& exploded, std::string* encoded) {
745 SerializeObject obj; 745 SerializeObject obj;
746 obj.version = kCurrentVersion; 746 obj.version = kCurrentVersion;
747 WritePageState(exploded, &obj); 747 WritePageState(exploded, &obj);
748 *encoded = obj.GetAsString(); 748 *encoded = obj.GetAsString();
749 return true;
750 } 749 }
751 750
752 #if defined(OS_ANDROID) 751 #if defined(OS_ANDROID)
753 bool DecodePageStateWithDeviceScaleFactorForTesting( 752 bool DecodePageStateWithDeviceScaleFactorForTesting(
754 const std::string& encoded, 753 const std::string& encoded,
755 float device_scale_factor, 754 float device_scale_factor,
756 ExplodedPageState* exploded) { 755 ExplodedPageState* exploded) {
757 g_device_scale_factor_for_testing = device_scale_factor; 756 g_device_scale_factor_for_testing = device_scale_factor;
758 bool rv = DecodePageState(encoded, exploded); 757 bool rv = DecodePageState(encoded, exploded);
759 g_device_scale_factor_for_testing = 0.0; 758 g_device_scale_factor_for_testing = 0.0;
(...skipping 13 matching lines...) Expand all
773 const ResourceRequestBodyImpl& resource_request_body) { 772 const ResourceRequestBodyImpl& resource_request_body) {
774 SerializeObject obj; 773 SerializeObject obj;
775 obj.version = kCurrentVersion; 774 obj.version = kCurrentVersion;
776 WriteResourceRequestBody(resource_request_body, &obj); 775 WriteResourceRequestBody(resource_request_body, &obj);
777 return obj.GetAsString(); 776 return obj.GetAsString();
778 } 777 }
779 778
780 #endif 779 #endif
781 780
782 } // namespace content 781 } // namespace content
OLDNEW
« no previous file with comments | « content/common/page_state_serialization.h ('k') | content/common/page_state_serialization_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698