Stop having renderers use both pids and a monotonically increasing "host_id". This allows ResourceDispatcher to be used by child processes other than renderers. I've done minor related cleanup on the way to make the code simpler.
Review URL: http://codereview.chromium.org/42054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11509 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/renderer_host/async_resource_handler.cc b/chrome/browser/renderer_host/async_resource_handler.cc
index 650c7c3..73aa227 100644
--- a/chrome/browser/renderer_host/async_resource_handler.cc
+++ b/chrome/browser/renderer_host/async_resource_handler.cc
@@ -35,15 +35,15 @@
AsyncResourceHandler::AsyncResourceHandler(
ResourceDispatcherHost::Receiver* receiver,
- int render_process_host_id,
+ int process_id,
int routing_id,
- base::ProcessHandle render_process,
+ base::ProcessHandle process_handle,
const GURL& url,
ResourceDispatcherHost* resource_dispatcher_host)
: receiver_(receiver),
- render_process_host_id_(render_process_host_id),
+ process_id_(process_id),
routing_id_(routing_id),
- render_process_(render_process),
+ process_handle_(process_handle),
rdh_(resource_dispatcher_host) {
}
@@ -91,18 +91,18 @@
return true;
DCHECK(read_buffer_.get());
- if (!rdh_->WillSendData(render_process_host_id_, request_id)) {
+ if (!rdh_->WillSendData(process_id_, request_id)) {
// We should not send this data now, we have too many pending requests.
return true;
}
base::SharedMemoryHandle handle;
- if (!read_buffer_->shared_memory()->GiveToProcess(render_process_, &handle)) {
+ if (!read_buffer_->shared_memory()->GiveToProcess(process_handle_, &handle)) {
// We wrongfully incremented the pending data count. Fake an ACK message
// to fix this. We can't move this call above the WillSendData because
// it's killing our read_buffer_, and we don't want that when we pause
// the request.
- rdh_->OnDataReceivedACK(render_process_host_id_, request_id);
+ rdh_->OnDataReceivedACK(process_id_, request_id);
// We just unmapped the memory.
read_buffer_ = NULL;
return false;