Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading |
| 6 | 6 |
| 7 #include "content/child/resource_dispatcher.h" | 7 #include "content/child/resource_dispatcher.h" |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 return; | 143 return; |
| 144 | 144 |
| 145 request_info->peer->OnUploadProgress(position, size); | 145 request_info->peer->OnUploadProgress(position, size); |
| 146 | 146 |
| 147 // Acknowledge receipt | 147 // Acknowledge receipt |
| 148 message_sender_->Send(new ResourceHostMsg_UploadProgress_ACK(request_id)); | 148 message_sender_->Send(new ResourceHostMsg_UploadProgress_ACK(request_id)); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void ResourceDispatcher::OnReceivedResponse( | 151 void ResourceDispatcher::OnReceivedResponse( |
| 152 int request_id, const ResourceResponseHead& response_head) { | 152 int request_id, const ResourceResponseHead& response_head) { |
| 153 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedResponse"); | 153 TRACE_EVENT0("loader,devtools.timeline", |
| 154 "ResourceDispatcher::OnReceivedResponse"); | |
|
caseq
2015/11/06 19:37:47
If we start exposing this in devtools trace, can w
alph
2015/11/06 21:04:51
We can't change this name as it seems to be used e
| |
| 154 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 155 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 155 if (!request_info) | 156 if (!request_info) |
| 156 return; | 157 return; |
| 157 request_info->response_start = ConsumeIOTimestamp(); | 158 request_info->response_start = ConsumeIOTimestamp(); |
| 158 | 159 |
| 159 if (delegate_) { | 160 if (delegate_) { |
| 160 RequestPeer* new_peer = | 161 RequestPeer* new_peer = |
| 161 delegate_->OnReceivedResponse( | 162 delegate_->OnReceivedResponse( |
| 162 request_info->peer, response_head.mime_type, request_info->url); | 163 request_info->peer, response_head.mime_type, request_info->url); |
| 163 if (new_peer) | 164 if (new_peer) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 // TODO(erikchen): Temporary debugging. http://crbug.com/527588. | 220 // TODO(erikchen): Temporary debugging. http://crbug.com/527588. |
| 220 CHECK_GE(shm_size, 0); | 221 CHECK_GE(shm_size, 0); |
| 221 CHECK_LE(shm_size, 512 * 1024); | 222 CHECK_LE(shm_size, 512 * 1024); |
| 222 request_info->buffer_size = shm_size; | 223 request_info->buffer_size = shm_size; |
| 223 } | 224 } |
| 224 | 225 |
| 225 void ResourceDispatcher::OnReceivedData(int request_id, | 226 void ResourceDispatcher::OnReceivedData(int request_id, |
| 226 int data_offset, | 227 int data_offset, |
| 227 int data_length, | 228 int data_length, |
| 228 int encoded_data_length) { | 229 int encoded_data_length) { |
| 229 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedData"); | 230 TRACE_EVENT0("loader,devtools.timeline", |
| 231 "ResourceDispatcher::OnReceivedData"); | |
| 230 DCHECK_GT(data_length, 0); | 232 DCHECK_GT(data_length, 0); |
| 231 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 233 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 232 bool send_ack = true; | 234 bool send_ack = true; |
| 233 if (request_info && data_length > 0) { | 235 if (request_info && data_length > 0) { |
| 234 // TODO(erikchen): Temporary debugging. http://crbug.com/550938. | 236 // TODO(erikchen): Temporary debugging. http://crbug.com/550938. |
| 235 CHECK(request_info->has_processed_buffer); | 237 CHECK(request_info->has_processed_buffer); |
| 236 CHECK(!request_info->has_destroyed_buffer); | 238 CHECK(!request_info->has_destroyed_buffer); |
| 237 CHECK(request_info->buffer.get()); | 239 CHECK(request_info->buffer.get()); |
| 238 | 240 |
| 239 CHECK(base::SharedMemory::IsHandleValid(request_info->buffer->handle())); | 241 CHECK(base::SharedMemory::IsHandleValid(request_info->buffer->handle())); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 int request_id, | 342 int request_id, |
| 341 PendingRequestInfo& request_info) { | 343 PendingRequestInfo& request_info) { |
| 342 IPC::Message* msg = request_info.pending_redirect_message.release(); | 344 IPC::Message* msg = request_info.pending_redirect_message.release(); |
| 343 if (msg) | 345 if (msg) |
| 344 message_sender_->Send(msg); | 346 message_sender_->Send(msg); |
| 345 } | 347 } |
| 346 | 348 |
| 347 void ResourceDispatcher::OnRequestComplete( | 349 void ResourceDispatcher::OnRequestComplete( |
| 348 int request_id, | 350 int request_id, |
| 349 const ResourceMsg_RequestCompleteData& request_complete_data) { | 351 const ResourceMsg_RequestCompleteData& request_complete_data) { |
| 350 TRACE_EVENT0("loader", "ResourceDispatcher::OnRequestComplete"); | 352 TRACE_EVENT0("loader,devtools.timeline", |
| 353 "ResourceDispatcher::OnRequestComplete"); | |
| 351 | 354 |
| 352 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 355 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 353 if (!request_info) | 356 if (!request_info) |
| 354 return; | 357 return; |
| 355 request_info->completion_time = ConsumeIOTimestamp(); | 358 request_info->completion_time = ConsumeIOTimestamp(); |
| 356 request_info->buffer.reset(); | 359 request_info->buffer.reset(); |
| 357 request_info->has_destroyed_buffer = true; | 360 request_info->has_destroyed_buffer = true; |
| 358 if (request_info->received_data_factory) | 361 if (request_info->received_data_factory) |
| 359 request_info->received_data_factory->Stop(); | 362 request_info->received_data_factory->Stop(); |
| 360 request_info->received_data_factory = nullptr; | 363 request_info->received_data_factory = nullptr; |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 833 *frame_origin = extra_data->frame_origin(); | 836 *frame_origin = extra_data->frame_origin(); |
| 834 return request.Pass(); | 837 return request.Pass(); |
| 835 } | 838 } |
| 836 | 839 |
| 837 void ResourceDispatcher::SetResourceSchedulingFilter( | 840 void ResourceDispatcher::SetResourceSchedulingFilter( |
| 838 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { | 841 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { |
| 839 resource_scheduling_filter_ = resource_scheduling_filter; | 842 resource_scheduling_filter_ = resource_scheduling_filter; |
| 840 } | 843 } |
| 841 | 844 |
| 842 } // namespace content | 845 } // namespace content |
| OLD | NEW |