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

Unified Diff: content/renderer/history_serialization.cc

Issue 2002413002: Revert of Deduplicating code performing WebHTTPBody::Element conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/public/common/page_state.cc ('k') | content/renderer/http_body_conversions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/history_serialization.cc
diff --git a/content/renderer/history_serialization.cc b/content/renderer/history_serialization.cc
index ac85324c1c097f5e0294936da7a1a0ef40a0e13b..0a4376c023cab71534f3f22fcde3ef5e989a27c2 100644
--- a/content/renderer/history_serialization.cc
+++ b/content/renderer/history_serialization.cc
@@ -6,12 +6,9 @@
#include <stddef.h>
-#include "base/strings/nullable_string16.h"
#include "content/common/page_state_serialization.h"
#include "content/public/common/page_state.h"
#include "content/renderer/history_entry.h"
-#include "content/renderer/http_body_conversions.h"
-#include "third_party/WebKit/public/platform/WebData.h"
#include "third_party/WebKit/public/platform/WebFloatPoint.h"
#include "third_party/WebKit/public/platform/WebHTTPBody.h"
#include "third_party/WebKit/public/platform/WebPoint.h"
@@ -20,7 +17,6 @@
#include "third_party/WebKit/public/web/WebHistoryItem.h"
#include "third_party/WebKit/public/web/WebSerializedScriptValue.h"
-using blink::WebData;
using blink::WebHTTPBody;
using blink::WebHistoryItem;
using blink::WebSerializedScriptValue;
@@ -35,6 +31,56 @@
output->reserve(output->size() + input.size());
for (size_t i = 0; i < input.size(); ++i)
output->push_back(input[i]);
+}
+
+void ToExplodedHttpBodyElement(const WebHTTPBody::Element& input,
+ ExplodedHttpBodyElement* output) {
+ switch (input.type) {
+ case WebHTTPBody::Element::TypeData:
+ output->data.assign(input.data.data(), input.data.size());
+ break;
+ case WebHTTPBody::Element::TypeFile:
+ output->file_path = input.filePath;
+ output->file_start = input.fileStart;
+ output->file_length = input.fileLength;
+ output->file_modification_time = input.modificationTime;
+ break;
+ case WebHTTPBody::Element::TypeFileSystemURL:
+ output->filesystem_url = input.fileSystemURL;
+ output->file_start = input.fileStart;
+ output->file_length = input.fileLength;
+ output->file_modification_time = input.modificationTime;
+ break;
+ case WebHTTPBody::Element::TypeBlob:
+ output->blob_uuid = input.blobUUID.utf8();
+ break;
+ }
+}
+
+void AppendHTTPBodyElement(const ExplodedHttpBodyElement& element,
+ WebHTTPBody* http_body) {
+ switch (element.type) {
+ case WebHTTPBody::Element::TypeData:
+ http_body->appendData(element.data);
+ break;
+ case WebHTTPBody::Element::TypeFile:
+ http_body->appendFileRange(
+ element.file_path,
+ element.file_start,
+ element.file_length,
+ element.file_modification_time);
+ break;
+ case WebHTTPBody::Element::TypeFileSystemURL:
+ http_body->appendFileSystemURLRange(
+ element.filesystem_url,
+ element.file_start,
+ element.file_length,
+ element.file_modification_time);
+ break;
+ case WebHTTPBody::Element::TypeBlob:
+ http_body->appendBlob(WebString::fromUTF8(element.blob_uuid));
+ break;
+ }
}
void GenerateFrameStateFromItem(const WebHistoryItem& item,
@@ -63,7 +109,7 @@
for (size_t i = 0; i < http_body.elementCount(); ++i) {
WebHTTPBody::Element element;
http_body.elementAt(i, element);
- ConvertToHttpBodyElement(element, &state->http_body.elements[i]);
+ ToExplodedHttpBodyElement(element, &state->http_body.elements[i]);
}
state->http_body.contains_passwords = http_body.containsPasswordData();
}
@@ -116,7 +162,7 @@
http_body.initialize();
http_body.setIdentifier(state.http_body.identifier);
for (size_t i = 0; i < state.http_body.elements.size(); ++i)
- AppendHttpBodyElement(state.http_body.elements[i], &http_body);
+ AppendHTTPBodyElement(state.http_body.elements[i], &http_body);
item.setHTTPBody(http_body);
}
node->set_item(item);
« no previous file with comments | « content/public/common/page_state.cc ('k') | content/renderer/http_body_conversions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698