diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-15 22:19:48 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-15 22:19:48 +0000 |
commit | 8e2b6472071f38c065a3d00adb136ef259ef68a1 (patch) | |
tree | 8a05864f6463e4948c6468139998a59eb6b54899 /chrome/browser/renderer_host/sync_resource_handler.cc | |
parent | 10a4a0aa5e9a1754752454ee2d4d8aff872a61a3 (diff) | |
download | chromium_src-8e2b6472071f38c065a3d00adb136ef259ef68a1.zip chromium_src-8e2b6472071f38c065a3d00adb136ef259ef68a1.tar.gz chromium_src-8e2b6472071f38c065a3d00adb136ef259ef68a1.tar.bz2 |
Create a ResourceMessageFilter to filter resource related IPCs. This gets rid of the awkward ResourceDispatcherHost::Receiver interface and allows a bunch of cleanup. I've also generalized the filtering done in WorkerProcessHost and moved it to ChildProcessHost (since it's now used to add the ResourceMessageFilter).
Review URL: http://codereview.chromium.org/5874002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/sync_resource_handler.cc')
-rw-r--r-- | chrome/browser/renderer_host/sync_resource_handler.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/chrome/browser/renderer_host/sync_resource_handler.cc b/chrome/browser/renderer_host/sync_resource_handler.cc index 6743e861..aa42c72 100644 --- a/chrome/browser/renderer_host/sync_resource_handler.cc +++ b/chrome/browser/renderer_host/sync_resource_handler.cc @@ -8,19 +8,19 @@ #include "chrome/browser/debugger/devtools_netlog_observer.h" #include "chrome/browser/net/load_timing_observer.h" #include "chrome/browser/renderer_host/global_request_id.h" +#include "chrome/browser/renderer_host/resource_dispatcher_host.h" +#include "chrome/browser/renderer_host/resource_message_filter.h" #include "chrome/common/render_messages.h" #include "net/base/io_buffer.h" #include "net/http/http_response_headers.h" SyncResourceHandler::SyncResourceHandler( - ResourceDispatcherHost::Receiver* receiver, - int process_id, + ResourceMessageFilter* filter, const GURL& url, IPC::Message* result_message, ResourceDispatcherHost* resource_dispatcher_host) : read_buffer_(new net::IOBuffer(kReadBufSize)), - receiver_(receiver), - process_id_(process_id), + filter_(filter), result_message_(result_message), rdh_(resource_dispatcher_host) { result_.final_url = url; @@ -40,7 +40,7 @@ bool SyncResourceHandler::OnRequestRedirected(int request_id, ResourceResponse* response, bool* defer) { net::URLRequest* request = rdh_->GetURLRequest( - GlobalRequestID(process_id_, request_id)); + GlobalRequestID(filter_->child_id(), request_id)); LoadTimingObserver::PopulateTimingInfo(request, response); DevToolsNetLogObserver::PopulateResponseInfo(request, response); // TODO(darin): It would be much better if this could live in WebCore, but @@ -57,7 +57,7 @@ bool SyncResourceHandler::OnRequestRedirected(int request_id, bool SyncResourceHandler::OnResponseStarted(int request_id, ResourceResponse* response) { net::URLRequest* request = rdh_->GetURLRequest( - GlobalRequestID(process_id_, request_id)); + GlobalRequestID(filter_->child_id(), request_id)); LoadTimingObserver::PopulateTimingInfo(request, response); DevToolsNetLogObserver::PopulateResponseInfo(request, response); @@ -103,7 +103,7 @@ bool SyncResourceHandler::OnResponseCompleted( result_.status = status; ViewHostMsg_SyncLoad::WriteReplyParams(result_message_, result_); - receiver_->Send(result_message_); + filter_->Send(result_message_); result_message_ = NULL; return true; } @@ -113,6 +113,5 @@ void SyncResourceHandler::OnRequestClosed() { return; result_message_->set_reply_error(); - receiver_->Send(result_message_); - receiver_ = NULL; // net::URLRequest is gone, and perhaps also the receiver. + filter_->Send(result_message_); } |