diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-06 19:24:05 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-06 19:24:05 +0000 |
commit | f465319aff0eac96b84b4f4754738b97a1c2dfed (patch) | |
tree | d7d4b376f8b808974001fa1aacf3ba6f28afd705 /content | |
parent | b926d6a87c7f9438d9c2b6a6eca638b52427737f (diff) | |
download | chromium_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')
-rw-r--r-- | content/browser/loader/async_resource_handler.cc | 29 | ||||
-rw-r--r-- | content/browser/loader/async_resource_handler.h | 2 | ||||
-rw-r--r-- | content/browser/loader/resource_dispatcher_host_impl.cc | 9 | ||||
-rw-r--r-- | content/browser/loader/resource_dispatcher_host_unittest.cc | 16 | ||||
-rw-r--r-- | content/browser/loader/resource_scheduler_unittest.cc | 3 | ||||
-rw-r--r-- | content/browser/renderer_host/render_process_host_impl.cc | 1 | ||||
-rw-r--r-- | content/child/resource_dispatcher.cc | 37 | ||||
-rw-r--r-- | content/child/resource_dispatcher.h | 7 | ||||
-rw-r--r-- | content/child/resource_dispatcher_unittest.cc | 14 | ||||
-rw-r--r-- | content/common/resource_messages.h | 98 | ||||
-rw-r--r-- | content/public/test/render_view_fake_resources_test.cc | 5 |
11 files changed, 94 insertions, 127 deletions
diff --git a/content/browser/loader/async_resource_handler.cc b/content/browser/loader/async_resource_handler.cc index 992eb65..ec70a3a 100644 --- a/content/browser/loader/async_resource_handler.cc +++ b/content/browser/loader/async_resource_handler.cc @@ -78,12 +78,10 @@ class DependentIOBuffer : public net::WrappedIOBuffer { AsyncResourceHandler::AsyncResourceHandler( ResourceMessageFilter* filter, - int routing_id, net::URLRequest* request, ResourceDispatcherHostImpl* rdh) : ResourceMessageDelegate(request), filter_(filter), - routing_id_(routing_id), request_(request), rdh_(rdh), pending_data_count_(0), @@ -139,8 +137,8 @@ void AsyncResourceHandler::OnDataReceivedACK(int request_id) { bool AsyncResourceHandler::OnUploadProgress(int request_id, uint64 position, uint64 size) { - return filter_->Send(new ResourceMsg_UploadProgress(routing_id_, request_id, - position, size)); + return filter_->Send(new ResourceMsg_UploadProgress(request_id, position, + size)); } bool AsyncResourceHandler::OnRequestRedirected(int request_id, @@ -159,7 +157,7 @@ bool AsyncResourceHandler::OnRequestRedirected(int request_id, response->head.request_start = request_->creation_time(); response->head.response_start = TimeTicks::Now(); return filter_->Send(new ResourceMsg_ReceivedRedirect( - routing_id_, request_id, new_url, response->head)); + request_id, new_url, response->head)); } bool AsyncResourceHandler::OnResponseStarted(int request_id, @@ -194,16 +192,14 @@ bool AsyncResourceHandler::OnResponseStarted(int request_id, response->head.request_start = request_->creation_time(); response->head.response_start = TimeTicks::Now(); - filter_->Send(new ResourceMsg_ReceivedResponse( - routing_id_, request_id, response->head)); + filter_->Send(new ResourceMsg_ReceivedResponse(request_id, response->head)); sent_received_response_msg_ = true; if (request_->response_info().metadata.get()) { std::vector<char> copy(request_->response_info().metadata->data(), request_->response_info().metadata->data() + request_->response_info().metadata->size()); - filter_->Send(new ResourceMsg_ReceivedCachedMetadata( - routing_id_, request_id, copy)); + filter_->Send(new ResourceMsg_ReceivedCachedMetadata(request_id, copy)); } return true; @@ -254,9 +250,8 @@ bool AsyncResourceHandler::OnReadCompleted(int request_id, int bytes_read, int size; if (!buffer_->ShareToProcess(filter_->PeerHandle(), &handle, &size)) return false; - filter_->Send( - new ResourceMsg_SetDataBuffer(routing_id_, request_id, handle, size, - filter_->peer_pid())); + filter_->Send(new ResourceMsg_SetDataBuffer( + request_id, handle, size, filter_->peer_pid())); sent_first_data_msg_ = true; } @@ -264,9 +259,8 @@ bool AsyncResourceHandler::OnReadCompleted(int request_id, int bytes_read, int encoded_data_length = DevToolsNetLogObserver::GetAndResetEncodedDataLength(request_); - filter_->Send( - new ResourceMsg_DataReceived(routing_id_, request_id, data_offset, - bytes_read, encoded_data_length)); + filter_->Send(new ResourceMsg_DataReceived( + request_id, data_offset, bytes_read, encoded_data_length)); ++pending_data_count_; UMA_HISTOGRAM_CUSTOM_COUNTS( "Net.AsyncResourceHandler_PendingDataCount", @@ -288,7 +282,7 @@ void AsyncResourceHandler::OnDataDownloaded( DevToolsNetLogObserver::GetAndResetEncodedDataLength(request_); filter_->Send(new ResourceMsg_DataDownloaded( - routing_id_, request_id, bytes_downloaded, encoded_data_length)); + request_id, bytes_downloaded, encoded_data_length)); } bool AsyncResourceHandler::OnResponseCompleted( @@ -331,8 +325,7 @@ bool AsyncResourceHandler::OnResponseCompleted( error_code = net::ERR_FAILED; } - filter_->Send(new ResourceMsg_RequestComplete(routing_id_, - request_id, + filter_->Send(new ResourceMsg_RequestComplete(request_id, error_code, was_ignored_by_handler, security_info, diff --git a/content/browser/loader/async_resource_handler.h b/content/browser/loader/async_resource_handler.h index 5f36112..b56055a 100644 --- a/content/browser/loader/async_resource_handler.h +++ b/content/browser/loader/async_resource_handler.h @@ -28,7 +28,6 @@ class AsyncResourceHandler : public ResourceHandler, public ResourceMessageDelegate { public: AsyncResourceHandler(ResourceMessageFilter* filter, - int routing_id, net::URLRequest* request, ResourceDispatcherHostImpl* rdh); virtual ~AsyncResourceHandler(); @@ -75,7 +74,6 @@ class AsyncResourceHandler : public ResourceHandler, scoped_refptr<ResourceBuffer> buffer_; scoped_refptr<ResourceMessageFilter> filter_; - int routing_id_; net::URLRequest* request_; ResourceDispatcherHostImpl* rdh_; diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc index 07d88b1..fdf01f0 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc @@ -138,7 +138,6 @@ const int kAllNetErrorCodes[] = { // Aborts a request before an URLRequest has actually been created. void AbortRequestBeforeItStarts(ResourceMessageFilter* filter, IPC::Message* sync_result, - int route_id, int request_id) { if (sync_result) { SyncLoadResult result; @@ -148,7 +147,6 @@ void AbortRequestBeforeItStarts(ResourceMessageFilter* filter, } else { // Tell the renderer that this request was disallowed. filter->Send(new ResourceMsg_RequestComplete( - route_id, request_id, net::ERR_ABORTED, false, @@ -929,7 +927,7 @@ void ResourceDispatcherHostImpl::BeginRequest( if (is_shutdown_ || !ShouldServiceRequest(process_type, child_id, request_data, filter_->file_system_context())) { - AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id); + AbortRequestBeforeItStarts(filter_, sync_result, request_id); return; } @@ -942,7 +940,7 @@ void ResourceDispatcherHostImpl::BeginRequest( request_data.url, request_data.resource_type, resource_context)) { - AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id); + AbortRequestBeforeItStarts(filter_, sync_result, request_id); return; } @@ -1041,8 +1039,7 @@ void ResourceDispatcherHostImpl::BeginRequest( handler.reset(new SyncResourceHandler( filter_, request, sync_result, this)); } else { - handler.reset(new AsyncResourceHandler( - filter_, route_id, request, this)); + handler.reset(new AsyncResourceHandler(filter_, request, this)); } // The RedirectToFileResourceHandler depends on being next in the chain. diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc index be46339..3818bed 100644 --- a/content/browser/loader/resource_dispatcher_host_unittest.cc +++ b/content/browser/loader/resource_dispatcher_host_unittest.cc @@ -708,7 +708,7 @@ class ResourceDispatcherHostTest : public testing::Test, bool result = PickleIterator(msg).ReadInt(&request_id); DCHECK(result); scoped_ptr<IPC::Message> ack( - new ResourceHostMsg_DataReceived_ACK(msg.routing_id(), request_id)); + new ResourceHostMsg_DataReceived_ACK(request_id)); base::MessageLoop::current()->PostTask( FROM_HERE, @@ -1609,7 +1609,7 @@ TEST_F(ResourceDispatcherHostTest, IgnoreCancelForDownloads) { EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); // And now simulate a cancellation coming from the renderer. - ResourceHostMsg_CancelRequest msg(filter_->child_id(), request_id); + ResourceHostMsg_CancelRequest msg(request_id); bool msg_was_ok; host_.OnMessageReceived(msg, filter_.get(), &msg_was_ok); @@ -1644,7 +1644,7 @@ TEST_F(ResourceDispatcherHostTest, CancelRequestsForContext) { EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); // And now simulate a cancellation coming from the renderer. - ResourceHostMsg_CancelRequest msg(filter_->child_id(), request_id); + ResourceHostMsg_CancelRequest msg(request_id); bool msg_was_ok; host_.OnMessageReceived(msg, filter_.get(), &msg_was_ok); @@ -1685,7 +1685,7 @@ TEST_F(ResourceDispatcherHostTest, CancelRequestsForContextTransferred) { GURL("http://example.com/blah")); // And now simulate a cancellation coming from the renderer. - ResourceHostMsg_CancelRequest msg(filter_->child_id(), request_id); + ResourceHostMsg_CancelRequest msg(request_id); bool msg_was_ok; host_.OnMessageReceived(msg, filter_.get(), &msg_was_ok); @@ -1832,7 +1832,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationAndThenRedirect) { // Now, simulate the renderer choosing to follow the redirect. ResourceHostMsg_FollowRedirect redirect_msg( - new_render_view_id, new_request_id, false, GURL()); + new_request_id, false, GURL()); host_.OnMessageReceived(redirect_msg, second_filter.get(), &msg_was_ok); base::MessageLoop::current()->RunUntilIdle(); @@ -1938,7 +1938,7 @@ TEST_F(ResourceDispatcherHostTest, DelayedDataReceivedACKs) { EXPECT_EQ(ResourceMsg_DataReceived::ID, msgs[0][i].type()); - ResourceHostMsg_DataReceived_ACK msg(0, 1); + ResourceHostMsg_DataReceived_ACK msg(1); bool msg_was_ok; host_.OnMessageReceived(msg, filter_.get(), &msg_was_ok); } @@ -1973,7 +1973,7 @@ TEST_F(ResourceDispatcherHostTest, DataReceivedUnexpectedACKs) { // Send some unexpected ACKs. for (size_t i = 0; i < 128; ++i) { - ResourceHostMsg_DataReceived_ACK msg(0, 1); + ResourceHostMsg_DataReceived_ACK msg(1); bool msg_was_ok; host_.OnMessageReceived(msg, filter_.get(), &msg_was_ok); } @@ -1992,7 +1992,7 @@ TEST_F(ResourceDispatcherHostTest, DataReceivedUnexpectedACKs) { EXPECT_EQ(ResourceMsg_DataReceived::ID, msgs[0][i].type()); - ResourceHostMsg_DataReceived_ACK msg(0, 1); + ResourceHostMsg_DataReceived_ACK msg(1); bool msg_was_ok; host_.OnMessageReceived(msg, filter_.get(), &msg_was_ok); } diff --git a/content/browser/loader/resource_scheduler_unittest.cc b/content/browser/loader/resource_scheduler_unittest.cc index 9d87f2d..7c46044 100644 --- a/content/browser/loader/resource_scheduler_unittest.cc +++ b/content/browser/loader/resource_scheduler_unittest.cc @@ -193,8 +193,7 @@ class ResourceSchedulerTest : public testing::Test { const ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest( request->url_request()); const GlobalRequestID& id = info->GetGlobalRequestID(); - ResourceHostMsg_DidChangePriority msg( - kRouteId, id.request_id, new_priority); + ResourceHostMsg_DidChangePriority msg(id.request_id, new_priority); bool ok = false; rdh_.OnMessageReceived(msg, filter.get(), &ok); EXPECT_TRUE(ok); diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 3082af3..e9ab929 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -1220,7 +1220,6 @@ bool RenderProcessHostImpl::OnMessageReceived(const IPC::Message& msg) { // Adding single handlers for your service here is fine, but once your // service needs more than one handler, please extract them into a new // message filter and add that filter to CreateMessageFilters(). - IPC_MESSAGE_UNHANDLED_ERROR() IPC_END_MESSAGE_MAP_EX() if (!msg_is_ok) { 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. diff --git a/content/common/resource_messages.h b/content/common/resource_messages.h index b6f1ac6..1eb4664 100644 --- a/content/common/resource_messages.h +++ b/content/common/resource_messages.h @@ -203,28 +203,28 @@ IPC_STRUCT_END() // Resource messages sent from the browser to the renderer. // Sent when the headers are available for a resource request. -IPC_MESSAGE_ROUTED2(ResourceMsg_ReceivedResponse, - int /* request_id */, - content::ResourceResponseHead) +IPC_MESSAGE_CONTROL2(ResourceMsg_ReceivedResponse, + int /* request_id */, + content::ResourceResponseHead) // Sent when cached metadata from a resource request is ready. -IPC_MESSAGE_ROUTED2(ResourceMsg_ReceivedCachedMetadata, - int /* request_id */, - std::vector<char> /* data */) +IPC_MESSAGE_CONTROL2(ResourceMsg_ReceivedCachedMetadata, + int /* request_id */, + std::vector<char> /* data */) // Sent as upload progress is being made. -IPC_MESSAGE_ROUTED3(ResourceMsg_UploadProgress, - int /* request_id */, - int64 /* position */, - int64 /* size */) +IPC_MESSAGE_CONTROL3(ResourceMsg_UploadProgress, + int /* request_id */, + int64 /* position */, + int64 /* size */) // Sent when the request has been redirected. The receiver is expected to // respond with either a FollowRedirect message (if the redirect is to be // followed) or a CancelRequest message (if it should not be followed). -IPC_MESSAGE_ROUTED3(ResourceMsg_ReceivedRedirect, - int /* request_id */, - GURL /* new_url */, - content::ResourceResponseHead) +IPC_MESSAGE_CONTROL3(ResourceMsg_ReceivedRedirect, + int /* request_id */, + GURL /* new_url */, + content::ResourceResponseHead) // Sent to set the shared memory buffer to be used to transmit response data to // the renderer. Subsequent DataReceived messages refer to byte ranges in the @@ -237,36 +237,36 @@ IPC_MESSAGE_ROUTED3(ResourceMsg_ReceivedRedirect, // TODO(darin): The |renderer_pid| parameter is just a temporary parameter, // added to help in debugging crbug/160401. // -IPC_MESSAGE_ROUTED4(ResourceMsg_SetDataBuffer, - int /* request_id */, - base::SharedMemoryHandle /* shm_handle */, - int /* shm_size */, - base::ProcessId /* renderer_pid */) +IPC_MESSAGE_CONTROL4(ResourceMsg_SetDataBuffer, + int /* request_id */, + base::SharedMemoryHandle /* shm_handle */, + int /* shm_size */, + base::ProcessId /* renderer_pid */) // Sent when some data from a resource request is ready. The data offset and // length specify a byte range into the shared memory buffer provided by the // SetDataBuffer message. -IPC_MESSAGE_ROUTED4(ResourceMsg_DataReceived, - int /* request_id */, - int /* data_offset */, - int /* data_length */, - int /* encoded_data_length */) +IPC_MESSAGE_CONTROL4(ResourceMsg_DataReceived, + int /* request_id */, + int /* data_offset */, + int /* data_length */, + int /* encoded_data_length */) // Sent when some data from a resource request has been downloaded to // file. This is only called in the 'download_to_file' case and replaces // ResourceMsg_DataReceived in the call sequence in that case. -IPC_MESSAGE_ROUTED3(ResourceMsg_DataDownloaded, - int /* request_id */, - int /* data_len */, - int /* encoded_data_length */) +IPC_MESSAGE_CONTROL3(ResourceMsg_DataDownloaded, + int /* request_id */, + int /* data_len */, + int /* encoded_data_length */) // Sent when the request has been completed. -IPC_MESSAGE_ROUTED5(ResourceMsg_RequestComplete, - int /* request_id */, - int /* error_code */, - bool /* was_ignored_by_handler */, - std::string /* security info */, - base::TimeTicks /* completion_time */) +IPC_MESSAGE_CONTROL5(ResourceMsg_RequestComplete, + int /* request_id */, + int /* error_code */, + bool /* was_ignored_by_handler */, + std::string /* security info */, + base::TimeTicks /* completion_time */) // Resource messages sent from the renderer to the browser. @@ -276,15 +276,15 @@ IPC_MESSAGE_ROUTED2(ResourceHostMsg_RequestResource, ResourceHostMsg_Request) // Cancels a resource request with the ID given as the parameter. -IPC_MESSAGE_ROUTED1(ResourceHostMsg_CancelRequest, - int /* request_id */) +IPC_MESSAGE_CONTROL1(ResourceHostMsg_CancelRequest, + int /* request_id */) // Follows a redirect that occured for the resource request with the ID given // as the parameter. -IPC_MESSAGE_ROUTED3(ResourceHostMsg_FollowRedirect, - int /* request_id */, - bool /* has_new_first_party_for_cookies */, - GURL /* new_first_party_for_cookies */) +IPC_MESSAGE_CONTROL3(ResourceHostMsg_FollowRedirect, + int /* request_id */, + bool /* has_new_first_party_for_cookies */, + GURL /* new_first_party_for_cookies */) // Makes a synchronous resource request via the browser. IPC_SYNC_MESSAGE_ROUTED2_1(ResourceHostMsg_SyncLoad, @@ -294,23 +294,23 @@ IPC_SYNC_MESSAGE_ROUTED2_1(ResourceHostMsg_SyncLoad, // Sent when the renderer process is done processing a DataReceived // message. -IPC_MESSAGE_ROUTED1(ResourceHostMsg_DataReceived_ACK, - int /* request_id */) +IPC_MESSAGE_CONTROL1(ResourceHostMsg_DataReceived_ACK, + int /* request_id */) // Sent when the renderer has processed a DataDownloaded message. -IPC_MESSAGE_ROUTED1(ResourceHostMsg_DataDownloaded_ACK, - int /* request_id */) +IPC_MESSAGE_CONTROL1(ResourceHostMsg_DataDownloaded_ACK, + int /* request_id */) // Sent by the renderer process to acknowledge receipt of a // UploadProgress message. -IPC_MESSAGE_ROUTED1(ResourceHostMsg_UploadProgress_ACK, - int /* request_id */) +IPC_MESSAGE_CONTROL1(ResourceHostMsg_UploadProgress_ACK, + int /* request_id */) // Sent when the renderer process deletes a resource loader. IPC_MESSAGE_CONTROL1(ResourceHostMsg_ReleaseDownloadedFile, int /* request_id */) // Sent by the renderer when a resource request changes priority. -IPC_MESSAGE_ROUTED2(ResourceHostMsg_DidChangePriority, - int /* request_id */, - net::RequestPriority) +IPC_MESSAGE_CONTROL2(ResourceHostMsg_DidChangePriority, + int /* request_id */, + net::RequestPriority) diff --git a/content/public/test/render_view_fake_resources_test.cc b/content/public/test/render_view_fake_resources_test.cc index 89c6900..e76ed5a 100644 --- a/content/public/test/render_view_fake_resources_test.cc +++ b/content/public/test/render_view_fake_resources_test.cc @@ -163,7 +163,7 @@ void RenderViewFakeResourcesTest::OnRequestResource( response_head.headers = new net::HttpResponseHeaders(headers); response_head.mime_type = "text/html"; ASSERT_TRUE(channel_->Send(new ResourceMsg_ReceivedResponse( - message.routing_id(), request_id, response_head))); + request_id, response_head))); base::SharedMemory shared_memory; ASSERT_TRUE(shared_memory.CreateAndMapAnonymous(body.size())); @@ -174,21 +174,18 @@ void RenderViewFakeResourcesTest::OnRequestResource( &handle)); ASSERT_TRUE(channel_->Send(new ResourceMsg_SetDataBuffer( - message.routing_id(), request_id, handle, body.size(), 0))); ASSERT_TRUE(channel_->Send(new ResourceMsg_DataReceived( - message.routing_id(), request_id, 0, body.size(), body.size()))); ASSERT_TRUE(channel_->Send(new ResourceMsg_RequestComplete( - message.routing_id(), request_id, net::OK, false, |