OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/mojo_async_resource_handler.h" | 5 #include "content/browser/loader/mojo_async_resource_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 upload_progress_tracker_ = CreateUploadProgressTracker( | 223 upload_progress_tracker_ = CreateUploadProgressTracker( |
224 FROM_HERE, | 224 FROM_HERE, |
225 base::BindRepeating(&MojoAsyncResourceHandler::SendUploadProgress, | 225 base::BindRepeating(&MojoAsyncResourceHandler::SendUploadProgress, |
226 base::Unretained(this))); | 226 base::Unretained(this))); |
227 } | 227 } |
228 | 228 |
229 controller->Resume(); | 229 controller->Resume(); |
230 } | 230 } |
231 | 231 |
232 bool MojoAsyncResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 232 bool MojoAsyncResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
233 int* buf_size, | 233 int* buf_size) { |
234 int min_size) { | |
235 DCHECK_EQ(-1, min_size); | |
236 | |
237 // TODO(mmenke): Cancel with net::ERR_INSUFFICIENT_RESOURCES instead. | 234 // TODO(mmenke): Cancel with net::ERR_INSUFFICIENT_RESOURCES instead. |
238 if (!CheckForSufficientResource()) | 235 if (!CheckForSufficientResource()) |
239 return false; | 236 return false; |
240 | 237 |
241 if (!shared_writer_) { | 238 if (!shared_writer_) { |
242 MojoCreateDataPipeOptions options; | 239 MojoCreateDataPipeOptions options; |
243 options.struct_size = sizeof(MojoCreateDataPipeOptions); | 240 options.struct_size = sizeof(MojoCreateDataPipeOptions); |
244 options.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE; | 241 options.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE; |
245 options.element_num_bytes = 1; | 242 options.element_num_bytes = 1; |
246 options.capacity_num_bytes = g_allocation_size; | 243 options.capacity_num_bytes = g_allocation_size; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 base::Bind(&MojoAsyncResourceHandler::OnUploadProgressACK, | 576 base::Bind(&MojoAsyncResourceHandler::OnUploadProgressACK, |
580 weak_factory_.GetWeakPtr())); | 577 weak_factory_.GetWeakPtr())); |
581 } | 578 } |
582 | 579 |
583 void MojoAsyncResourceHandler::OnUploadProgressACK() { | 580 void MojoAsyncResourceHandler::OnUploadProgressACK() { |
584 if (upload_progress_tracker_) | 581 if (upload_progress_tracker_) |
585 upload_progress_tracker_->OnAckReceived(); | 582 upload_progress_tracker_->OnAckReceived(); |
586 } | 583 } |
587 | 584 |
588 } // namespace content | 585 } // namespace content |
OLD | NEW |