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

Unified Diff: content/child/resource_dispatcher.h

Issue 226273005: Remove webkit's ResourceLoaderBridge interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASED Created 6 years, 8 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/child/npapi/plugin_url_fetcher.cc ('k') | content/child/resource_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/resource_dispatcher.h
diff --git a/content/child/resource_dispatcher.h b/content/child/resource_dispatcher.h
index 5aabbd4e91880d1c35a25252f5b8c093fe1c2522..6b8d5a0bc354d7a1f89aafbf02bd19bfb90316b9 100644
--- a/content/child/resource_dispatcher.h
+++ b/content/child/resource_dispatcher.h
@@ -12,6 +12,7 @@
#include "base/containers/hash_tables.h"
#include "base/memory/linked_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
@@ -21,6 +22,7 @@
#include "net/base/request_priority.h"
#include "webkit/common/resource_type.h"
+struct ResourceHostMsg_Request;
struct ResourceMsg_RequestCompleteData;
namespace webkit_glue {
@@ -31,9 +33,11 @@ struct ResourceResponseInfo;
namespace content {
class RequestPeer;
class ResourceDispatcherDelegate;
+class ResourceRequestBody;
struct RequestInfo;
struct ResourceResponseHead;
struct SiteIsolationResponseMetaData;
+struct SyncLoadResponse;
// This class serves as a communication interface between the
// ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in
@@ -46,36 +50,37 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
// IPC::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
- // Creates a ResourceLoaderBridge for this type of dispatcher, this is so
- // this can be tested regardless of the ResourceLoaderBridge::Create
- // implementation.
- webkit_glue::ResourceLoaderBridge* CreateBridge(
- const RequestInfo& request_info);
-
- // Adds a request from the pending_requests_ list, returning the new
- // requests' ID
- int AddPendingRequest(RequestPeer* callback,
- ResourceType::Type resource_type,
- int origin_pid,
- const GURL& frame_origin,
- const GURL& request_url);
-
- // Removes a request from the pending_requests_ list, returning true if the
+
+ // Call this method to load the resource synchronously (i.e., in one shot).
+ // This is an alternative to the StartAsync method. Be warned that this method
+ // will block the calling thread until the resource is fully downloaded or an
+ // error occurs. It could block the calling thread for a long time, so only
+ // 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
+ // response parameter.
+ void StartSync(const RequestInfo& request_info,
+ ResourceRequestBody* request_body,
+ SyncLoadResponse* response);
+
+ // Call this method to initiate the request. If this method succeeds, then
+ // the peer's methods will be called asynchronously to report various events.
+ // Returns the request id.
+ int StartAsync(const RequestInfo& request_info,
+ ResourceRequestBody* request_body,
+ RequestPeer* peer);
+
+ // Removes a request from the |pending_requests_| list, returning true if the
// request was found and removed.
bool RemovePendingRequest(int request_id);
- // Cancels a request in the pending_requests_ list.
- void CancelPendingRequest(int request_id);
-
- IPC::Sender* message_sender() const {
- return message_sender_;
- }
+ // Cancels a request in the |pending_requests_| list.
+ void Cancel(int request_id);
// Toggles the is_deferred attribute for the specified request.
void SetDefersLoading(int request_id, bool value);
// Indicates the priority of the specified request changed.
- void DidChangePriority(int routing_id, int request_id,
+ void DidChangePriority(int request_id,
net::RequestPriority new_priority,
int intra_priority_value);
@@ -101,7 +106,8 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
ResourceType::Type resource_type,
int origin_pid,
const GURL& frame_origin,
- const GURL& request_url);
+ const GURL& request_url,
+ bool download_to_file);
~PendingRequestInfo();
@@ -119,6 +125,7 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
GURL frame_origin;
// The url of the latest response even in case of redirection.
GURL response_url;
+ bool download_to_file;
linked_ptr<IPC::Message> pending_redirect_message;
base::TimeTicks request_start;
base::TimeTicks response_start;
@@ -138,33 +145,24 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
void FollowPendingRedirect(int request_id, PendingRequestInfo& request_info);
// Message response handlers, called by the message handler for this process.
- void OnUploadProgress(
- int request_id,
- int64 position,
- int64 size);
+ void OnUploadProgress(int request_id, int64 position, int64 size);
void OnReceivedResponse(int request_id, const ResourceResponseHead&);
void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data);
- void OnReceivedRedirect(
- int request_id,
- const GURL& new_url,
- const ResourceResponseHead& response_head);
- void OnSetDataBuffer(
- int request_id,
- base::SharedMemoryHandle shm_handle,
- int shm_size,
- base::ProcessId renderer_pid);
- void OnReceivedData(
- int request_id,
- int data_offset,
- int data_length,
- int encoded_data_length);
- void OnDownloadedData(
- int request_id,
- int data_len,
- int encoded_data_length);
+ void OnReceivedRedirect(int request_id,
+ const GURL& new_url,
+ const ResourceResponseHead& response_head);
+ void OnSetDataBuffer(int request_id,
+ base::SharedMemoryHandle shm_handle,
+ int shm_size,
+ base::ProcessId renderer_pid);
+ void OnReceivedData(int request_id,
+ int data_offset,
+ int data_length,
+ int encoded_data_length);
+ void OnDownloadedData(int request_id, int data_len, int encoded_data_length);
void OnRequestComplete(
int request_id,
- const ResourceMsg_RequestCompleteData &request_complete_data);
+ const ResourceMsg_RequestCompleteData& request_complete_data);
// Dispatch the message to one of the message response handlers.
void DispatchMessage(const IPC::Message& message);
@@ -201,6 +199,11 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
// for use on deferred message queues that are no longer needed.
static void ReleaseResourcesInMessageQueue(MessageQueue* queue);
+ scoped_ptr<ResourceHostMsg_Request> CreateRequest(
+ const RequestInfo& request_info,
+ ResourceRequestBody* request_body,
+ GURL* frame_origin);
+
IPC::Sender* message_sender_;
// All pending requests issued to the host
« no previous file with comments | « content/child/npapi/plugin_url_fetcher.cc ('k') | content/child/resource_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698