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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 void ResourceDispatcher::OnReceivedData(int request_id, | 215 void ResourceDispatcher::OnReceivedData(int request_id, |
216 int data_offset, | 216 int data_offset, |
217 int data_length, | 217 int data_length, |
218 int encoded_data_length) { | 218 int encoded_data_length) { |
219 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedData"); | 219 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedData"); |
220 DCHECK_GT(data_length, 0); | 220 DCHECK_GT(data_length, 0); |
221 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 221 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
222 bool send_ack = true; | 222 bool send_ack = true; |
223 if (request_info && data_length > 0) { | 223 if (request_info && data_length > 0) { |
224 // TODO(erikchen): Temporary code to help track http://crbug.com/527588. | |
225 base::debug::Alias(request_info); | |
226 int buffer_size = request_info->buffer_size; | |
227 base::debug::Alias(&buffer_size); | |
228 | |
229 CHECK(base::SharedMemory::IsHandleValid(request_info->buffer->handle())); | 224 CHECK(base::SharedMemory::IsHandleValid(request_info->buffer->handle())); |
230 CHECK_GE(request_info->buffer_size, data_offset + data_length); | 225 CHECK_GE(request_info->buffer_size, data_offset + data_length); |
231 | 226 |
232 // Ensure that the SHM buffer remains valid for the duration of this scope. | 227 // Ensure that the SHM buffer remains valid for the duration of this scope. |
233 // It is possible for Cancel() to be called before we exit this scope. | 228 // It is possible for Cancel() to be called before we exit this scope. |
234 // SharedMemoryReceivedDataFactory stores the SHM buffer inside it. | 229 // SharedMemoryReceivedDataFactory stores the SHM buffer inside it. |
235 scoped_refptr<SharedMemoryReceivedDataFactory> factory( | 230 scoped_refptr<SharedMemoryReceivedDataFactory> factory( |
236 request_info->received_data_factory); | 231 request_info->received_data_factory); |
237 | 232 |
238 base::TimeTicks time_start = base::TimeTicks::Now(); | 233 base::TimeTicks time_start = base::TimeTicks::Now(); |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 extra_data->transferred_request_request_id(); | 790 extra_data->transferred_request_request_id(); |
796 request->service_worker_provider_id = | 791 request->service_worker_provider_id = |
797 extra_data->service_worker_provider_id(); | 792 extra_data->service_worker_provider_id(); |
798 request->request_body = request_body; | 793 request->request_body = request_body; |
799 if (frame_origin) | 794 if (frame_origin) |
800 *frame_origin = extra_data->frame_origin(); | 795 *frame_origin = extra_data->frame_origin(); |
801 return request.Pass(); | 796 return request.Pass(); |
802 } | 797 } |
803 | 798 |
804 } // namespace content | 799 } // namespace content |
OLD | NEW |