| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 upload_progress_tracker_ = base::MakeUnique<UploadProgressTracker>( | 361 upload_progress_tracker_ = base::MakeUnique<UploadProgressTracker>( |
| 362 FROM_HERE, | 362 FROM_HERE, |
| 363 base::BindRepeating(&AsyncResourceHandler::SendUploadProgress, | 363 base::BindRepeating(&AsyncResourceHandler::SendUploadProgress, |
| 364 base::Unretained(this)), | 364 base::Unretained(this)), |
| 365 request()); | 365 request()); |
| 366 } | 366 } |
| 367 controller->Resume(); | 367 controller->Resume(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 bool AsyncResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 370 bool AsyncResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 371 int* buf_size, | 371 int* buf_size) { |
| 372 int min_size) { | |
| 373 DCHECK(!has_controller()); | 372 DCHECK(!has_controller()); |
| 374 DCHECK_EQ(-1, min_size); | |
| 375 | 373 |
| 376 // TODO(mmenke): Should fail with ERR_INSUFFICIENT_RESOURCES here. | 374 // TODO(mmenke): Should fail with ERR_INSUFFICIENT_RESOURCES here. |
| 377 if (!CheckForSufficientResource()) | 375 if (!CheckForSufficientResource()) |
| 378 return false; | 376 return false; |
| 379 | 377 |
| 380 // Return early if InliningHelper allocates the buffer, so that we should | 378 // Return early if InliningHelper allocates the buffer, so that we should |
| 381 // inline the data into the IPC message without allocating SharedMemory. | 379 // inline the data into the IPC message without allocating SharedMemory. |
| 382 if (inlining_helper_->PrepareInlineBufferIfApplicable(buf, buf_size)) | 380 if (inlining_helper_->PrepareInlineBufferIfApplicable(buf, buf_size)) |
| 383 return true; | 381 return true; |
| 384 | 382 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 void AsyncResourceHandler::SendUploadProgress( | 620 void AsyncResourceHandler::SendUploadProgress( |
| 623 const net::UploadProgress& progress) { | 621 const net::UploadProgress& progress) { |
| 624 ResourceMessageFilter* filter = GetFilter(); | 622 ResourceMessageFilter* filter = GetFilter(); |
| 625 if (!filter) | 623 if (!filter) |
| 626 return; | 624 return; |
| 627 filter->Send(new ResourceMsg_UploadProgress( | 625 filter->Send(new ResourceMsg_UploadProgress( |
| 628 GetRequestID(), progress.position(), progress.size())); | 626 GetRequestID(), progress.position(), progress.size())); |
| 629 } | 627 } |
| 630 | 628 |
| 631 } // namespace content | 629 } // namespace content |
| OLD | NEW |