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