summaryrefslogtreecommitdiffstats
path: root/content/child
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-06 19:24:05 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-06 19:24:05 +0000
commitf465319aff0eac96b84b4f4754738b97a1c2dfed (patch)
treed7d4b376f8b808974001fa1aacf3ba6f28afd705 /content/child
parentb926d6a87c7f9438d9c2b6a6eca638b52427737f (diff)
downloadchromium_src-f465319aff0eac96b84b4f4754738b97a1c2dfed.zip
chromium_src-f465319aff0eac96b84b4f4754738b97a1c2dfed.tar.gz
chromium_src-f465319aff0eac96b84b4f4754738b97a1c2dfed.tar.bz2
Convert a bunch of resource IPCs to be control messages. They didn't need to be routed.
BUG=286074 R=ajwong@chromium.org Review URL: https://codereview.chromium.org/23583039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221751 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/child')
-rw-r--r--content/child/resource_dispatcher.cc37
-rw-r--r--content/child/resource_dispatcher.h7
-rw-r--r--content/child/resource_dispatcher_unittest.cc14
3 files changed, 21 insertions, 37 deletions
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
index ed5016e..003a360 100644
--- a/content/child/resource_dispatcher.cc
+++ b/content/child/resource_dispatcher.cc
@@ -200,7 +200,7 @@ void IPCResourceLoaderBridge::Cancel() {
}
if (!is_synchronous_request_)
- dispatcher_->CancelPendingRequest(routing_id_, request_id_);
+ dispatcher_->CancelPendingRequest(request_id_);
// We can't remove the request ID from the resource dispatcher because more
// data might be pending. Sending the cancel message may cause more data
@@ -324,8 +324,8 @@ ResourceDispatcher::GetPendingRequestInfo(int request_id) {
return &(it->second);
}
-void ResourceDispatcher::OnUploadProgress(
- const IPC::Message& message, int request_id, int64 position, int64 size) {
+void ResourceDispatcher::OnUploadProgress(int request_id, int64 position,
+ int64 size) {
PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
if (!request_info)
return;
@@ -333,8 +333,7 @@ void ResourceDispatcher::OnUploadProgress(
request_info->peer->OnUploadProgress(position, size);
// Acknowledge receipt
- message_sender()->Send(
- new ResourceHostMsg_UploadProgress_ACK(message.routing_id(), request_id));
+ message_sender()->Send(new ResourceHostMsg_UploadProgress_ACK(request_id));
}
void ResourceDispatcher::OnReceivedResponse(
@@ -373,8 +372,7 @@ void ResourceDispatcher::OnReceivedCachedMetadata(
request_info->peer->OnReceivedCachedMetadata(&data.front(), data.size());
}
-void ResourceDispatcher::OnSetDataBuffer(const IPC::Message& message,
- int request_id,
+void ResourceDispatcher::OnSetDataBuffer(int request_id,
base::SharedMemoryHandle shm_handle,
int shm_size,
base::ProcessId renderer_pid) {
@@ -404,8 +402,7 @@ void ResourceDispatcher::OnSetDataBuffer(const IPC::Message& message,
request_info->buffer_size = shm_size;
}
-void ResourceDispatcher::OnReceivedData(const IPC::Message& message,
- int request_id,
+void ResourceDispatcher::OnReceivedData(int request_id,
int data_offset,
int data_length,
int encoded_data_length) {
@@ -449,17 +446,15 @@ void ResourceDispatcher::OnReceivedData(const IPC::Message& message,
}
// Acknowledge the reception of this data.
- message_sender()->Send(
- new ResourceHostMsg_DataReceived_ACK(message.routing_id(), request_id));
+ message_sender()->Send(new ResourceHostMsg_DataReceived_ACK(request_id));
}
-void ResourceDispatcher::OnDownloadedData(const IPC::Message& message,
- int request_id,
+void ResourceDispatcher::OnDownloadedData(int request_id,
int data_len,
int encoded_data_length) {
// Acknowledge the reception of this message.
message_sender()->Send(
- new ResourceHostMsg_DataDownloaded_ACK(message.routing_id(), request_id));
+ new ResourceHostMsg_DataDownloaded_ACK(request_id));
PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
if (!request_info)
@@ -469,7 +464,6 @@ void ResourceDispatcher::OnDownloadedData(const IPC::Message& message,
}
void ResourceDispatcher::OnReceivedRedirect(
- const IPC::Message& message,
int request_id,
const GURL& new_url,
const ResourceResponseHead& response_head) {
@@ -478,7 +472,6 @@ void ResourceDispatcher::OnReceivedRedirect(
return;
request_info->response_start = ConsumeIOTimestamp();
- int32 routing_id = message.routing_id();
bool has_new_first_party_for_cookies = false;
GURL new_first_party_for_cookies;
ResourceResponseInfo renderer_response_info;
@@ -495,14 +488,14 @@ void ResourceDispatcher::OnReceivedRedirect(
// SiteIsolationPolicy later when OnReceivedResponse is called.
request_info->response_url = new_url;
request_info->pending_redirect_message.reset(
- new ResourceHostMsg_FollowRedirect(routing_id, request_id,
+ new ResourceHostMsg_FollowRedirect(request_id,
has_new_first_party_for_cookies,
new_first_party_for_cookies));
if (!request_info->is_deferred) {
FollowPendingRedirect(request_id, *request_info);
}
} else {
- CancelPendingRequest(routing_id, request_id);
+ CancelPendingRequest(request_id);
}
}
@@ -574,8 +567,7 @@ bool ResourceDispatcher::RemovePendingRequest(int request_id) {
return true;
}
-void ResourceDispatcher::CancelPendingRequest(int routing_id,
- int request_id) {
+void ResourceDispatcher::CancelPendingRequest(int request_id) {
PendingRequestList::iterator it = pending_requests_.find(request_id);
if (it == pending_requests_.end()) {
DVLOG(1) << "unknown request";
@@ -587,8 +579,7 @@ void ResourceDispatcher::CancelPendingRequest(int routing_id,
ReleaseResourcesInMessageQueue(&request_info.deferred_message_queue);
pending_requests_.erase(it);
- message_sender()->Send(
- new ResourceHostMsg_CancelRequest(routing_id, request_id));
+ message_sender()->Send(new ResourceHostMsg_CancelRequest(request_id));
}
void ResourceDispatcher::SetDefersLoading(int request_id, bool value) {
@@ -617,7 +608,7 @@ void ResourceDispatcher::DidChangePriority(
int routing_id, int request_id, net::RequestPriority new_priority) {
DCHECK(ContainsKey(pending_requests_, request_id));
message_sender()->Send(new ResourceHostMsg_DidChangePriority(
- routing_id, request_id, new_priority));
+ request_id, new_priority));
}
ResourceDispatcher::PendingRequestInfo::PendingRequestInfo()
diff --git a/content/child/resource_dispatcher.h b/content/child/resource_dispatcher.h
index 4166e20..d85087d 100644
--- a/content/child/resource_dispatcher.h
+++ b/content/child/resource_dispatcher.h
@@ -54,7 +54,7 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
bool RemovePendingRequest(int request_id);
// Cancels a request in the pending_requests_ list.
- void CancelPendingRequest(int routing_id, int request_id);
+ void CancelPendingRequest(int request_id);
IPC::Sender* message_sender() const {
return message_sender_;
@@ -125,31 +125,26 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
// Message response handlers, called by the message handler for this process.
void OnUploadProgress(
- const IPC::Message& message,
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(
- const IPC::Message& message,
int request_id,
const GURL& new_url,
const ResourceResponseHead& response_head);
void OnSetDataBuffer(
- const IPC::Message& message,
int request_id,
base::SharedMemoryHandle shm_handle,
int shm_size,
base::ProcessId renderer_pid);
void OnReceivedData(
- const IPC::Message& message,
int request_id,
int data_offset,
int data_length,
int encoded_data_length);
void OnDownloadedData(
- const IPC::Message& message,
int request_id,
int data_len,
int encoded_data_length);
diff --git a/content/child/resource_dispatcher_unittest.cc b/content/child/resource_dispatcher_unittest.cc
index 817bf91..b072ecf 100644
--- a/content/child/resource_dispatcher_unittest.cc
+++ b/content/child/resource_dispatcher_unittest.cc
@@ -134,10 +134,9 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender {
base::SharedMemoryHandle dup_handle;
EXPECT_TRUE(shared_mem.GiveToProcess(
base::Process::Current().handle(), &dup_handle));
- dispatcher_->OnSetDataBuffer(message_queue_[0], request_id, dup_handle,
+ dispatcher_->OnSetDataBuffer(request_id, dup_handle,
test_page_contents_len, 0);
- dispatcher_->OnReceivedData(message_queue_[0], request_id, 0,
- test_page_contents_len,
+ dispatcher_->OnReceivedData(request_id, 0, test_page_contents_len,
test_page_contents_len);
message_queue_.erase(message_queue_.begin());
@@ -251,7 +250,7 @@ class DeferredResourceLoadingTest : public ResourceDispatcherTest,
response_head.error_code = net::OK;
dispatcher_->OnMessageReceived(
- ResourceMsg_ReceivedResponse(0, 0, response_head));
+ ResourceMsg_ReceivedResponse(0, response_head));
// Duplicate the shared memory handle so both the test and the callee can
// close their copy.
@@ -260,9 +259,8 @@ class DeferredResourceLoadingTest : public ResourceDispatcherTest,
&duplicated_handle));
dispatcher_->OnMessageReceived(
- ResourceMsg_SetDataBuffer(0, 0, duplicated_handle, 100, 0));
- dispatcher_->OnMessageReceived(
- ResourceMsg_DataReceived(0, 0, 0, 100, 100));
+ ResourceMsg_SetDataBuffer(0, duplicated_handle, 100, 0));
+ dispatcher_->OnMessageReceived(ResourceMsg_DataReceived(0, 0, 100, 100));
set_defer_loading(false);
}
@@ -355,7 +353,7 @@ class TimeConversionTest : public ResourceDispatcherTest,
bridge->Start(this);
dispatcher_->OnMessageReceived(
- ResourceMsg_ReceivedResponse(0, 0, response_head));
+ ResourceMsg_ReceivedResponse(0, response_head));
}
// ResourceLoaderBridge::Peer methods.