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 | |
337 filter->Send(new ResourceMsg_DataReceived( | 332 filter->Send(new ResourceMsg_DataReceived( |
338 GetRequestID(), data_offset, bytes_read, encoded_data_length)); | 333 GetRequestID(), data_offset, bytes_read, encoded_data_length)); |
339 ++pending_data_count_; | 334 ++pending_data_count_; |
340 | 335 |
341 if (!buffer_->CanAllocate()) { | 336 if (!buffer_->CanAllocate()) { |
342 *defer = did_defer_ = true; | 337 *defer = did_defer_ = true; |
343 OnDefer(); | 338 OnDefer(); |
344 } | 339 } |
345 | 340 |
346 return true; | 341 return true; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 request()->LogUnblocked(); | 430 request()->LogUnblocked(); |
436 controller()->Resume(); | 431 controller()->Resume(); |
437 } | 432 } |
438 } | 433 } |
439 | 434 |
440 void AsyncResourceHandler::OnDefer() { | 435 void AsyncResourceHandler::OnDefer() { |
441 request()->LogBlockedBy("AsyncResourceHandler"); | 436 request()->LogBlockedBy("AsyncResourceHandler"); |
442 } | 437 } |
443 | 438 |
444 } // namespace content | 439 } // namespace content |
OLD | NEW |