Commit 81403749 authored by tfarina@chromium.org's avatar tfarina@chromium.org

Extract SyncLoadResponse struct from ResourceLoaderBridge.

And move it into content/child/sync_load_response.*.

As requested by John in -
https://codereview.chromium.org/186193005/diff/1/content/public/child/resource_loader_bridge.h#newcode111

BUG=265753, 338338, 237249
TEST=content_unittests
R=jam@chromium.org
TBR=darin

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260466 0039d316-1c4b-4281-b951-d872f2087c98
parent 588de284
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ipc/ipc_sender.h" #include "ipc/ipc_sender.h"
#include "webkit/child/resource_loader_bridge.h" #include "webkit/child/resource_loader_bridge.h"
#include "webkit/common/resource_response_info.h"
// The ExtensionLocalizationPeer is a proxy to a // The ExtensionLocalizationPeer is a proxy to a
// webkit_glue::ResourceLoaderBridge::Peer instance. It is used to pre-process // webkit_glue::ResourceLoaderBridge::Peer instance. It is used to pre-process
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define CHROME_RENDERER_SECURITY_FILTER_PEER_H_ #define CHROME_RENDERER_SECURITY_FILTER_PEER_H_
#include "webkit/child/resource_loader_bridge.h" #include "webkit/child/resource_loader_bridge.h"
#include "webkit/common/resource_response_info.h"
#include "webkit/common/resource_type.h" #include "webkit/common/resource_type.h"
// The SecurityFilterPeer is a proxy to a // The SecurityFilterPeer is a proxy to a
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "third_party/WebKit/public/platform/WebURLLoaderClient.h" #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
#include "third_party/WebKit/public/platform/WebURLResponse.h" #include "third_party/WebKit/public/platform/WebURLResponse.h"
#include "webkit/child/multipart_response_delegate.h" #include "webkit/child/multipart_response_delegate.h"
#include "webkit/common/resource_response_info.h"
namespace content { namespace content {
namespace { namespace {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "content/child/request_extra_data.h" #include "content/child/request_extra_data.h"
#include "content/child/request_info.h" #include "content/child/request_info.h"
#include "content/child/site_isolation_policy.h" #include "content/child/site_isolation_policy.h"
#include "content/child/sync_load_response.h"
#include "content/common/inter_process_time_ticks_converter.h" #include "content/common/inter_process_time_ticks_converter.h"
#include "content/common/resource_messages.h" #include "content/common/resource_messages.h"
#include "content/common/service_worker/service_worker_types.h" #include "content/common/service_worker/service_worker_types.h"
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/child/sync_load_response.h"
namespace content {
SyncLoadResponse::SyncLoadResponse() {}
SyncLoadResponse::~SyncLoadResponse() {}
} // namespace content
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_CHILD_SYNC_LOAD_RESPONSE_H_
#define CONTENT_CHILD_SYNC_LOAD_RESPONSE_H_
#include <string>
#include "url/gurl.h"
#include "webkit/common/resource_response_info.h"
namespace content {
// See the SyncLoad method. (The name of this struct is not
// suffixed with "Info" because it also contains the response data.)
struct SyncLoadResponse : webkit_glue::ResourceResponseInfo {
SyncLoadResponse();
~SyncLoadResponse();
// The response error code.
int error_code;
// The final URL of the response. This may differ from the request URL in
// the case of a server redirect.
GURL url;
// The response data.
std::string data;
};
} // namespace content
#endif // CONTENT_CHILD_SYNC_LOAD_RESPONSE_H_
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "content/child/ftp_directory_listing_response_delegate.h" #include "content/child/ftp_directory_listing_response_delegate.h"
#include "content/child/request_extra_data.h" #include "content/child/request_extra_data.h"
#include "content/child/request_info.h" #include "content/child/request_info.h"
#include "content/child/sync_load_response.h"
#include "content/common/resource_request_body.h" #include "content/common/resource_request_body.h"
#include "net/base/data_url.h" #include "net/base/data_url.h"
#include "net/base/load_flags.h" #include "net/base/load_flags.h"
...@@ -231,7 +232,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>, ...@@ -231,7 +232,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>,
void SetDefersLoading(bool value); void SetDefersLoading(bool value);
void DidChangePriority(WebURLRequest::Priority new_priority); void DidChangePriority(WebURLRequest::Priority new_priority);
void Start(const WebURLRequest& request, void Start(const WebURLRequest& request,
ResourceLoaderBridge::SyncLoadResponse* sync_load_response); SyncLoadResponse* sync_load_response);
// ResourceLoaderBridge::Peer methods: // ResourceLoaderBridge::Peer methods:
virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE;
...@@ -306,9 +307,8 @@ void WebURLLoaderImpl::Context::DidChangePriority( ...@@ -306,9 +307,8 @@ void WebURLLoaderImpl::Context::DidChangePriority(
ConvertWebKitPriorityToNetPriority(new_priority)); ConvertWebKitPriorityToNetPriority(new_priority));
} }
void WebURLLoaderImpl::Context::Start( void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
const WebURLRequest& request, SyncLoadResponse* sync_load_response) {
ResourceLoaderBridge::SyncLoadResponse* sync_load_response) {
DCHECK(!bridge_.get()); DCHECK(!bridge_.get());
request_ = request; // Save the request. request_ = request; // Save the request.
...@@ -828,7 +828,7 @@ void WebURLLoaderImpl::loadSynchronously(const WebURLRequest& request, ...@@ -828,7 +828,7 @@ void WebURLLoaderImpl::loadSynchronously(const WebURLRequest& request,
WebURLResponse& response, WebURLResponse& response,
WebURLError& error, WebURLError& error,
WebData& data) { WebData& data) {
ResourceLoaderBridge::SyncLoadResponse sync_load_response; SyncLoadResponse sync_load_response;
context_->Start(request, &sync_load_response); context_->Start(request, &sync_load_response);
const GURL& final_url = sync_load_response.url; const GURL& final_url = sync_load_response.url;
......
...@@ -161,10 +161,12 @@ ...@@ -161,10 +161,12 @@
'child/site_isolation_policy.h', 'child/site_isolation_policy.h',
'child/socket_stream_dispatcher.cc', 'child/socket_stream_dispatcher.cc',
'child/socket_stream_dispatcher.h', 'child/socket_stream_dispatcher.h',
'child/touch_fling_gesture_curve.cc', 'child/sync_load_response.cc',
'child/touch_fling_gesture_curve.h', 'child/sync_load_response.h',
'child/thread_safe_sender.cc', 'child/thread_safe_sender.cc',
'child/thread_safe_sender.h', 'child/thread_safe_sender.h',
'child/touch_fling_gesture_curve.cc',
'child/touch_fling_gesture_curve.h',
'child/web_database_observer_impl.cc', 'child/web_database_observer_impl.cc',
'child/web_database_observer_impl.h', 'child/web_database_observer_impl.h',
'child/web_discardable_memory_impl.cc', 'child/web_discardable_memory_impl.cc',
......
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
namespace webkit_glue { namespace webkit_glue {
ResourceLoaderBridge::SyncLoadResponse::SyncLoadResponse() {}
ResourceLoaderBridge::SyncLoadResponse::~SyncLoadResponse() {}
ResourceLoaderBridge::ResourceLoaderBridge() {} ResourceLoaderBridge::ResourceLoaderBridge() {}
ResourceLoaderBridge::~ResourceLoaderBridge() {} ResourceLoaderBridge::~ResourceLoaderBridge() {}
......
...@@ -28,35 +28,20 @@ ...@@ -28,35 +28,20 @@
#include "net/base/request_priority.h" #include "net/base/request_priority.h"
#include "url/gurl.h" #include "url/gurl.h"
#include "webkit/child/webkit_child_export.h" #include "webkit/child/webkit_child_export.h"
#include "webkit/common/resource_response_info.h"
// TODO(pilgrim) remove this once resource loader is moved to content // TODO(pilgrim) remove this once resource loader is moved to content
// http://crbug.com/338338 // http://crbug.com/338338
namespace content { namespace content {
class ResourceRequestBody; class ResourceRequestBody;
struct SyncLoadResponse;
} }
namespace webkit_glue { namespace webkit_glue {
struct ResourceResponseInfo;
class ResourceLoaderBridge { class ResourceLoaderBridge {
public: public:
// See the SyncLoad method declared below. (The name of this struct is not
// suffixed with "Info" because it also contains the response data.)
struct SyncLoadResponse : ResourceResponseInfo {
WEBKIT_CHILD_EXPORT SyncLoadResponse();
WEBKIT_CHILD_EXPORT ~SyncLoadResponse();
// The response error code.
int error_code;
// The final URL of the response. This may differ from the request URL in
// the case of a server redirect.
GURL url;
// The response data.
std::string data;
};
// Generated by the bridge. This is implemented by our custom resource loader // Generated by the bridge. This is implemented by our custom resource loader
// within webkit. The Peer and it's bridge should have identical lifetimes // within webkit. The Peer and it's bridge should have identical lifetimes
// as they represent each end of a communication channel. // as they represent each end of a communication channel.
...@@ -156,7 +141,7 @@ class ResourceLoaderBridge { ...@@ -156,7 +141,7 @@ class ResourceLoaderBridge {
// use this if you really need it! There is also no way for the caller to // use this if you really need it! There is also no way for the caller to
// interrupt this method. Errors are reported via the status field of the // interrupt this method. Errors are reported via the status field of the
// response parameter. // response parameter.
virtual void SyncLoad(SyncLoadResponse* response) = 0; virtual void SyncLoad(content::SyncLoadResponse* response) = 0;
protected: protected:
// Construction must go through // Construction must go through
......
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