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 #include "content/browser/loader/async_resource_handler.h" | 5 #include "content/browser/loader/async_resource_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 GetRequestID(), handle, size, filter->peer_pid())); | 322 GetRequestID(), handle, size, filter->peer_pid())); |
323 sent_first_data_msg_ = true; | 323 sent_first_data_msg_ = true; |
324 } | 324 } |
325 | 325 |
326 int data_offset = buffer_->GetLastAllocationOffset(); | 326 int data_offset = buffer_->GetLastAllocationOffset(); |
327 | 327 |
328 int64_t current_transfer_size = request()->GetTotalReceivedBytes(); | 328 int64_t current_transfer_size = request()->GetTotalReceivedBytes(); |
329 int encoded_data_length = current_transfer_size - reported_transfer_size_; | 329 int encoded_data_length = current_transfer_size - reported_transfer_size_; |
330 reported_transfer_size_ = current_transfer_size; | 330 reported_transfer_size_ = current_transfer_size; |
331 | 331 |
| 332 // TODO(erikchen): Remove me after finished debugging for |
| 333 // http://crbug.com/527588. |
| 334 // The data offset can't exceed the size of the buffer. |
| 335 CHECK_LE(data_offset, kBufferSize); |
| 336 |
332 filter->Send(new ResourceMsg_DataReceived( | 337 filter->Send(new ResourceMsg_DataReceived( |
333 GetRequestID(), data_offset, bytes_read, encoded_data_length)); | 338 GetRequestID(), data_offset, bytes_read, encoded_data_length)); |
334 ++pending_data_count_; | 339 ++pending_data_count_; |
335 | 340 |
336 if (!buffer_->CanAllocate()) { | 341 if (!buffer_->CanAllocate()) { |
337 *defer = did_defer_ = true; | 342 *defer = did_defer_ = true; |
338 OnDefer(); | 343 OnDefer(); |
339 } | 344 } |
340 | 345 |
341 return true; | 346 return true; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 request()->LogUnblocked(); | 435 request()->LogUnblocked(); |
431 controller()->Resume(); | 436 controller()->Resume(); |
432 } | 437 } |
433 } | 438 } |
434 | 439 |
435 void AsyncResourceHandler::OnDefer() { | 440 void AsyncResourceHandler::OnDefer() { |
436 request()->LogBlockedBy("AsyncResourceHandler"); | 441 request()->LogBlockedBy("AsyncResourceHandler"); |
437 } | 442 } |
438 | 443 |
439 } // namespace content | 444 } // namespace content |
OLD | NEW |