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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 if (request_info && data_length > 0) { | 238 if (request_info && data_length > 0) { |
239 CHECK(base::SharedMemory::IsHandleValid(request_info->buffer->handle())); | 239 CHECK(base::SharedMemory::IsHandleValid(request_info->buffer->handle())); |
240 CHECK_GE(request_info->buffer_size, data_offset + data_length); | 240 CHECK_GE(request_info->buffer_size, data_offset + data_length); |
241 | 241 |
242 // TODO(erikchen): Temporary debugging. http://crbug.com/527588. | 242 // TODO(erikchen): Temporary debugging. http://crbug.com/527588. |
243 CHECK_GE(request_info->buffer_size, 0); | 243 CHECK_GE(request_info->buffer_size, 0); |
244 CHECK_LE(request_info->buffer_size, 512 * 1024); | 244 CHECK_LE(request_info->buffer_size, 512 * 1024); |
245 CHECK_GE(data_length, 0); | 245 CHECK_GE(data_length, 0); |
246 CHECK_LE(data_length, 512 * 1024); | 246 CHECK_LE(data_length, 512 * 1024); |
247 | 247 |
248 int cached_data_offset = request_info->data_offset; | 248 if (data_offset > 512 * 1024) { |
249 CHECK_EQ(cached_data_offset, data_offset); | 249 int cached_data_offset = request_info->data_offset; |
| 250 base::debug::Alias(&cached_data_offset); |
| 251 CHECK(false); |
| 252 } |
250 | 253 |
251 // Ensure that the SHM buffer remains valid for the duration of this scope. | 254 // Ensure that the SHM buffer remains valid for the duration of this scope. |
252 // It is possible for Cancel() to be called before we exit this scope. | 255 // It is possible for Cancel() to be called before we exit this scope. |
253 // SharedMemoryReceivedDataFactory stores the SHM buffer inside it. | 256 // SharedMemoryReceivedDataFactory stores the SHM buffer inside it. |
254 scoped_refptr<SharedMemoryReceivedDataFactory> factory( | 257 scoped_refptr<SharedMemoryReceivedDataFactory> factory( |
255 request_info->received_data_factory); | 258 request_info->received_data_factory); |
256 | 259 |
257 base::TimeTicks time_start = base::TimeTicks::Now(); | 260 base::TimeTicks time_start = base::TimeTicks::Now(); |
258 | 261 |
259 const char* data_start = static_cast<char*>(request_info->buffer->memory()); | 262 const char* data_start = static_cast<char*>(request_info->buffer->memory()); |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 *frame_origin = extra_data->frame_origin(); | 837 *frame_origin = extra_data->frame_origin(); |
835 return request.Pass(); | 838 return request.Pass(); |
836 } | 839 } |
837 | 840 |
838 void ResourceDispatcher::SetResourceSchedulingFilter( | 841 void ResourceDispatcher::SetResourceSchedulingFilter( |
839 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { | 842 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { |
840 resource_scheduling_filter_ = resource_scheduling_filter; | 843 resource_scheduling_filter_ = resource_scheduling_filter; |
841 } | 844 } |
842 | 845 |
843 } // namespace content | 846 } // namespace content |
OLD | NEW |