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

Unified Diff: content/common/page_state_serialization.cc

Issue 2954343005: Merge ResourceRequestBodyImpl and ResourceRequestBody. (Closed)
Patch Set: Remove comment Created 3 years, 6 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/common/page_state_serialization.h ('k') | content/common/page_state_serialization_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/page_state_serialization.cc
diff --git a/content/common/page_state_serialization.cc b/content/common/page_state_serialization.cc
index 41da923898881da9e74437c08c8d1e373a33fac1..c4289a56f50fc7e1690cb0d0be1df07f24434c40 100644
--- a/content/common/page_state_serialization.cc
+++ b/content/common/page_state_serialization.cc
@@ -15,7 +15,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
-#include "content/common/resource_request_body_impl.h"
+#include "content/public/common/resource_request_body.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
@@ -29,14 +29,14 @@ float g_device_scale_factor_for_testing = 0.0;
//-----------------------------------------------------------------------------
void AppendDataToRequestBody(
- const scoped_refptr<ResourceRequestBodyImpl>& request_body,
+ const scoped_refptr<ResourceRequestBody>& request_body,
const char* data,
int data_length) {
request_body->AppendBytes(data, data_length);
}
void AppendFileRangeToRequestBody(
- const scoped_refptr<ResourceRequestBodyImpl>& request_body,
+ const scoped_refptr<ResourceRequestBody>& request_body,
const base::NullableString16& file_path,
int file_start,
int file_length,
@@ -48,7 +48,7 @@ void AppendFileRangeToRequestBody(
}
void AppendURLRangeToRequestBody(
- const scoped_refptr<ResourceRequestBodyImpl>& request_body,
+ const scoped_refptr<ResourceRequestBody>& request_body,
const GURL& url,
int file_start,
int file_length,
@@ -60,7 +60,7 @@ void AppendURLRangeToRequestBody(
}
void AppendBlobToRequestBody(
- const scoped_refptr<ResourceRequestBodyImpl>& request_body,
+ const scoped_refptr<ResourceRequestBody>& request_body,
const std::string& uuid) {
request_body->AppendBlob(uuid);
}
@@ -68,10 +68,10 @@ void AppendBlobToRequestBody(
//----------------------------------------------------------------------------
void AppendReferencedFilesFromHttpBody(
- const std::vector<ResourceRequestBodyImpl::Element>& elements,
+ const std::vector<ResourceRequestBody::Element>& elements,
std::vector<base::NullableString16>* referenced_files) {
for (size_t i = 0; i < elements.size(); ++i) {
- if (elements[i].type() == ResourceRequestBodyImpl::Element::TYPE_FILE)
+ if (elements[i].type() == ResourceRequestBody::Element::TYPE_FILE)
referenced_files->push_back(
base::NullableString16(elements[i].path().AsUTF16Unsafe(), false));
}
@@ -393,16 +393,16 @@ void ReadStringVector(SerializeObject* obj,
(*result)[i] = ReadString(obj);
}
-void WriteResourceRequestBody(const ResourceRequestBodyImpl& request_body,
+void WriteResourceRequestBody(const ResourceRequestBody& request_body,
SerializeObject* obj) {
WriteAndValidateVectorSize(*request_body.elements(), obj);
for (const auto& element : *request_body.elements()) {
switch (element.type()) {
- case ResourceRequestBodyImpl::Element::TYPE_BYTES:
+ case ResourceRequestBody::Element::TYPE_BYTES:
WriteInteger(blink::WebHTTPBody::Element::kTypeData, obj);
WriteData(element.bytes(), static_cast<int>(element.length()), obj);
break;
- case ResourceRequestBodyImpl::Element::TYPE_FILE:
+ case ResourceRequestBody::Element::TYPE_FILE:
WriteInteger(blink::WebHTTPBody::Element::kTypeFile, obj);
WriteString(
base::NullableString16(element.path().AsUTF16Unsafe(), false), obj);
@@ -410,19 +410,19 @@ void WriteResourceRequestBody(const ResourceRequestBodyImpl& request_body,
WriteInteger64(static_cast<int64_t>(element.length()), obj);
WriteReal(element.expected_modification_time().ToDoubleT(), obj);
break;
- case ResourceRequestBodyImpl::Element::TYPE_FILE_FILESYSTEM:
+ case ResourceRequestBody::Element::TYPE_FILE_FILESYSTEM:
WriteInteger(blink::WebHTTPBody::Element::kTypeFileSystemURL, obj);
WriteGURL(element.filesystem_url(), obj);
WriteInteger64(static_cast<int64_t>(element.offset()), obj);
WriteInteger64(static_cast<int64_t>(element.length()), obj);
WriteReal(element.expected_modification_time().ToDoubleT(), obj);
break;
- case ResourceRequestBodyImpl::Element::TYPE_BLOB:
+ case ResourceRequestBody::Element::TYPE_BLOB:
WriteInteger(blink::WebHTTPBody::Element::kTypeBlob, obj);
WriteStdString(element.blob_uuid(), obj);
break;
- case ResourceRequestBodyImpl::Element::TYPE_BYTES_DESCRIPTION:
- case ResourceRequestBodyImpl::Element::TYPE_DISK_CACHE_ENTRY:
+ case ResourceRequestBody::Element::TYPE_BYTES_DESCRIPTION:
+ case ResourceRequestBody::Element::TYPE_DISK_CACHE_ENTRY:
default:
NOTREACHED();
continue;
@@ -433,7 +433,7 @@ void WriteResourceRequestBody(const ResourceRequestBodyImpl& request_body,
void ReadResourceRequestBody(
SerializeObject* obj,
- const scoped_refptr<ResourceRequestBodyImpl>& request_body) {
+ const scoped_refptr<ResourceRequestBody>& request_body) {
int num_elements = ReadInteger(obj);
for (int i = 0; i < num_elements; ++i) {
int type = ReadInteger(obj);
@@ -487,7 +487,7 @@ void ReadHttpBody(SerializeObject* obj, ExplodedHttpBody* http_body) {
if (!ReadBoolean(obj))
return;
- http_body->request_body = new ResourceRequestBodyImpl();
+ http_body->request_body = new ResourceRequestBody();
ReadResourceRequestBody(obj, http_body->request_body);
if (obj->version >= 12)
@@ -781,10 +781,9 @@ bool DecodePageStateWithDeviceScaleFactorForTesting(
return rv;
}
-scoped_refptr<ResourceRequestBodyImpl> DecodeResourceRequestBody(
- const char* data,
- size_t size) {
- scoped_refptr<ResourceRequestBodyImpl> result = new ResourceRequestBodyImpl();
+scoped_refptr<ResourceRequestBody> DecodeResourceRequestBody(const char* data,
+ size_t size) {
+ scoped_refptr<ResourceRequestBody> result = new ResourceRequestBody();
SerializeObject obj(data, static_cast<int>(size));
ReadResourceRequestBody(&obj, result);
// Please see the EncodeResourceRequestBody() function below for information
@@ -795,7 +794,7 @@ scoped_refptr<ResourceRequestBodyImpl> DecodeResourceRequestBody(
}
std::string EncodeResourceRequestBody(
- const ResourceRequestBodyImpl& resource_request_body) {
+ const ResourceRequestBody& resource_request_body) {
SerializeObject obj;
obj.version = kCurrentVersion;
WriteResourceRequestBody(resource_request_body, &obj);
« 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