Commit 015fd327 authored by davidben's avatar davidben Committed by Commit bot

Move ResourceResponseHead::error_code to SyncLoadResult.

Apart from the places which expect a SyncLoadResult, it's only read in
RedirectToFileResourceHandler. In that case, it's always net::OK;
ResourceLoader checks request_->status().is_success() first in
OnResponseStarted before calling CompleteResponseStarted().

BUG=none

Review URL: https://codereview.chromium.org/517853004

Cr-Commit-Position: refs/heads/master@{#293216}
parent 6d0a8336
...@@ -157,11 +157,8 @@ void RedirectToFileResourceHandler:: ...@@ -157,11 +157,8 @@ void RedirectToFileResourceHandler::
bool RedirectToFileResourceHandler::OnResponseStarted( bool RedirectToFileResourceHandler::OnResponseStarted(
ResourceResponse* response, ResourceResponse* response,
bool* defer) { bool* defer) {
if (response->head.error_code == net::OK || DCHECK(writer_);
response->head.error_code == net::ERR_IO_PENDING) { response->head.download_file_path = writer_->path();
DCHECK(writer_);
response->head.download_file_path = writer_->path();
}
return next_handler_->OnResponseStarted(response, defer); return next_handler_->OnResponseStarted(response, defer);
} }
......
...@@ -42,7 +42,6 @@ namespace { ...@@ -42,7 +42,6 @@ namespace {
void PopulateResourceResponse(ResourceRequestInfoImpl* info, void PopulateResourceResponse(ResourceRequestInfoImpl* info,
net::URLRequest* request, net::URLRequest* request,
ResourceResponse* response) { ResourceResponse* response) {
response->head.error_code = request->status().error();
response->head.request_time = request->request_time(); response->head.request_time = request->request_time();
response->head.response_time = request->response_time(); response->head.response_time = request->response_time();
response->head.headers = request->response_headers(); response->head.headers = request->response_headers();
......
...@@ -250,7 +250,6 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender { ...@@ -250,7 +250,6 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender {
std::string raw_headers(kTestRedirectHeaders); std::string raw_headers(kTestRedirectHeaders);
std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0'); std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0');
head.headers = new net::HttpResponseHeaders(raw_headers); head.headers = new net::HttpResponseHeaders(raw_headers);
head.error_code = net::OK;
net::RedirectInfo redirect_info; net::RedirectInfo redirect_info;
redirect_info.status_code = 302; redirect_info.status_code = 302;
redirect_info.new_method = "GET"; redirect_info.new_method = "GET";
...@@ -267,7 +266,6 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender { ...@@ -267,7 +266,6 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender {
head.headers = new net::HttpResponseHeaders(raw_headers); head.headers = new net::HttpResponseHeaders(raw_headers);
head.mime_type = kTestPageMimeType; head.mime_type = kTestPageMimeType;
head.charset = kTestPageCharset; head.charset = kTestPageCharset;
head.error_code = net::OK;
EXPECT_EQ(true, EXPECT_EQ(true,
dispatcher_.OnMessageReceived( dispatcher_.OnMessageReceived(
ResourceMsg_ReceivedResponse(request_id, head))); ResourceMsg_ReceivedResponse(request_id, head)));
...@@ -760,7 +758,6 @@ class TimeConversionTest : public ResourceDispatcherTest, ...@@ -760,7 +758,6 @@ class TimeConversionTest : public ResourceDispatcherTest,
// TODO(simonjam): Enable this when 10829031 lands. // TODO(simonjam): Enable this when 10829031 lands.
TEST_F(TimeConversionTest, DISABLED_ProperlyInitialized) { TEST_F(TimeConversionTest, DISABLED_ProperlyInitialized) {
ResourceResponseHead response_head; ResourceResponseHead response_head;
response_head.error_code = net::OK;
response_head.request_start = base::TimeTicks::FromInternalValue(5); response_head.request_start = base::TimeTicks::FromInternalValue(5);
response_head.response_start = base::TimeTicks::FromInternalValue(15); response_head.response_start = base::TimeTicks::FromInternalValue(15);
response_head.load_timing.request_start_time = base::Time::Now(); response_head.load_timing.request_start_time = base::Time::Now();
...@@ -780,7 +777,6 @@ TEST_F(TimeConversionTest, DISABLED_ProperlyInitialized) { ...@@ -780,7 +777,6 @@ TEST_F(TimeConversionTest, DISABLED_ProperlyInitialized) {
TEST_F(TimeConversionTest, PartiallyInitialized) { TEST_F(TimeConversionTest, PartiallyInitialized) {
ResourceResponseHead response_head; ResourceResponseHead response_head;
response_head.error_code = net::OK;
response_head.request_start = base::TimeTicks::FromInternalValue(5); response_head.request_start = base::TimeTicks::FromInternalValue(5);
response_head.response_start = base::TimeTicks::FromInternalValue(15); response_head.response_start = base::TimeTicks::FromInternalValue(15);
...@@ -793,7 +789,6 @@ TEST_F(TimeConversionTest, PartiallyInitialized) { ...@@ -793,7 +789,6 @@ TEST_F(TimeConversionTest, PartiallyInitialized) {
TEST_F(TimeConversionTest, NotInitialized) { TEST_F(TimeConversionTest, NotInitialized) {
ResourceResponseHead response_head; ResourceResponseHead response_head;
response_head.error_code = net::OK;
PerformTest(response_head); PerformTest(response_head);
......
...@@ -86,13 +86,13 @@ IPC_ENUM_TRAITS_MAX_VALUE( \ ...@@ -86,13 +86,13 @@ IPC_ENUM_TRAITS_MAX_VALUE( \
IPC_STRUCT_TRAITS_BEGIN(content::ResourceResponseHead) IPC_STRUCT_TRAITS_BEGIN(content::ResourceResponseHead)
IPC_STRUCT_TRAITS_PARENT(content::ResourceResponseInfo) IPC_STRUCT_TRAITS_PARENT(content::ResourceResponseInfo)
IPC_STRUCT_TRAITS_MEMBER(error_code)
IPC_STRUCT_TRAITS_MEMBER(request_start) IPC_STRUCT_TRAITS_MEMBER(request_start)
IPC_STRUCT_TRAITS_MEMBER(response_start) IPC_STRUCT_TRAITS_MEMBER(response_start)
IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(content::SyncLoadResult) IPC_STRUCT_TRAITS_BEGIN(content::SyncLoadResult)
IPC_STRUCT_TRAITS_PARENT(content::ResourceResponseHead) IPC_STRUCT_TRAITS_PARENT(content::ResourceResponseHead)
IPC_STRUCT_TRAITS_MEMBER(error_code)
IPC_STRUCT_TRAITS_MEMBER(final_url) IPC_STRUCT_TRAITS_MEMBER(final_url)
IPC_STRUCT_TRAITS_MEMBER(data) IPC_STRUCT_TRAITS_MEMBER(data)
IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_END()
......
...@@ -20,8 +20,6 @@ namespace content { ...@@ -20,8 +20,6 @@ namespace content {
// Parameters for a resource response header. // Parameters for a resource response header.
struct ResourceResponseHead : ResourceResponseInfo { struct ResourceResponseHead : ResourceResponseInfo {
// The response error_code.
int error_code;
// TimeTicks::Now() when the browser received the request from the renderer. // TimeTicks::Now() when the browser received the request from the renderer.
base::TimeTicks request_start; base::TimeTicks request_start;
// TimeTicks::Now() when the browser sent the response to the renderer. // TimeTicks::Now() when the browser sent the response to the renderer.
...@@ -30,6 +28,8 @@ struct ResourceResponseHead : ResourceResponseInfo { ...@@ -30,6 +28,8 @@ struct ResourceResponseHead : ResourceResponseInfo {
// Parameters for a synchronous resource response. // Parameters for a synchronous resource response.
struct SyncLoadResult : ResourceResponseHead { struct SyncLoadResult : ResourceResponseHead {
// The response error_code.
int error_code;
// The final URL after any redirects. // The final URL after any redirects.
GURL final_url; GURL final_url;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment