| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } else { | 138 } else { |
| 139 GetRequestInfo()->set_on_transfer(base::Bind(&NotReached)); | 139 GetRequestInfo()->set_on_transfer(base::Bind(&NotReached)); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 MojoAsyncResourceHandler::~MojoAsyncResourceHandler() { | 143 MojoAsyncResourceHandler::~MojoAsyncResourceHandler() { |
| 144 if (has_checked_for_sufficient_resources_) | 144 if (has_checked_for_sufficient_resources_) |
| 145 rdh_->FinishedWithResourcesForRequest(request()); | 145 rdh_->FinishedWithResourcesForRequest(request()); |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool MojoAsyncResourceHandler::OnRequestRedirected( | 148 void MojoAsyncResourceHandler::OnRequestRedirected( |
| 149 const net::RedirectInfo& redirect_info, | 149 const net::RedirectInfo& redirect_info, |
| 150 ResourceResponse* response, | 150 ResourceResponse* response, |
| 151 bool* defer) { | 151 std::unique_ptr<ResourceController> controller) { |
| 152 // Unlike OnResponseStarted, OnRequestRedirected will NOT be preceded by | 152 // Unlike OnResponseStarted, OnRequestRedirected will NOT be preceded by |
| 153 // OnWillRead. | 153 // OnWillRead. |
| 154 DCHECK(!has_controller()); |
| 154 DCHECK(!shared_writer_); | 155 DCHECK(!shared_writer_); |
| 155 | 156 |
| 156 *defer = true; | |
| 157 request()->LogBlockedBy("MojoAsyncResourceHandler"); | 157 request()->LogBlockedBy("MojoAsyncResourceHandler"); |
| 158 HoldController(std::move(controller)); |
| 158 did_defer_on_redirect_ = true; | 159 did_defer_on_redirect_ = true; |
| 159 | 160 |
| 160 NetLogObserver::PopulateResponseInfo(request(), response); | 161 NetLogObserver::PopulateResponseInfo(request(), response); |
| 161 response->head.encoded_data_length = request()->GetTotalReceivedBytes(); | 162 response->head.encoded_data_length = request()->GetTotalReceivedBytes(); |
| 162 response->head.request_start = request()->creation_time(); | 163 response->head.request_start = request()->creation_time(); |
| 163 response->head.response_start = base::TimeTicks::Now(); | 164 response->head.response_start = base::TimeTicks::Now(); |
| 164 // TODO(davidben): Is it necessary to pass the new first party URL for | 165 // TODO(davidben): Is it necessary to pass the new first party URL for |
| 165 // cookies? The only case where it can change is top-level navigation requests | 166 // cookies? The only case where it can change is top-level navigation requests |
| 166 // and hopefully those will eventually all be owned by the browser. It's | 167 // and hopefully those will eventually all be owned by the browser. It's |
| 167 // possible this is still needed while renderer-owned ones exist. | 168 // possible this is still needed while renderer-owned ones exist. |
| 168 url_loader_client_->OnReceiveRedirect(redirect_info, response->head); | 169 url_loader_client_->OnReceiveRedirect(redirect_info, response->head); |
| 169 return true; | |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool MojoAsyncResourceHandler::OnResponseStarted(ResourceResponse* response, | 172 void MojoAsyncResourceHandler::OnResponseStarted( |
| 173 bool* defer) { | 173 ResourceResponse* response, |
| 174 std::unique_ptr<ResourceController> controller) { |
| 175 DCHECK(!has_controller()); |
| 176 |
| 174 if (upload_progress_tracker_) { | 177 if (upload_progress_tracker_) { |
| 175 upload_progress_tracker_->OnUploadCompleted(); | 178 upload_progress_tracker_->OnUploadCompleted(); |
| 176 upload_progress_tracker_ = nullptr; | 179 upload_progress_tracker_ = nullptr; |
| 177 } | 180 } |
| 178 | 181 |
| 179 const ResourceRequestInfoImpl* info = GetRequestInfo(); | 182 const ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 180 if (rdh_->delegate()) { | 183 if (rdh_->delegate()) { |
| 181 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(), | 184 rdh_->delegate()->OnResponseStarted(request(), info->GetContext(), |
| 182 response); | 185 response); |
| 183 } | 186 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 201 url_loader_client_->OnReceiveResponse(response->head, | 204 url_loader_client_->OnReceiveResponse(response->head, |
| 202 std::move(downloaded_file_ptr)); | 205 std::move(downloaded_file_ptr)); |
| 203 | 206 |
| 204 net::IOBufferWithSize* metadata = GetResponseMetadata(request()); | 207 net::IOBufferWithSize* metadata = GetResponseMetadata(request()); |
| 205 if (metadata) { | 208 if (metadata) { |
| 206 const uint8_t* data = reinterpret_cast<const uint8_t*>(metadata->data()); | 209 const uint8_t* data = reinterpret_cast<const uint8_t*>(metadata->data()); |
| 207 | 210 |
| 208 url_loader_client_->OnReceiveCachedMetadata( | 211 url_loader_client_->OnReceiveCachedMetadata( |
| 209 std::vector<uint8_t>(data, data + metadata->size())); | 212 std::vector<uint8_t>(data, data + metadata->size())); |
| 210 } | 213 } |
| 211 return true; | 214 |
| 215 controller->Resume(); |
| 212 } | 216 } |
| 213 | 217 |
| 214 bool MojoAsyncResourceHandler::OnWillStart(const GURL& url, bool* defer) { | 218 void MojoAsyncResourceHandler::OnWillStart( |
| 219 const GURL& url, |
| 220 std::unique_ptr<ResourceController> controller) { |
| 215 if (GetRequestInfo()->is_upload_progress_enabled() && | 221 if (GetRequestInfo()->is_upload_progress_enabled() && |
| 216 request()->has_upload()) { | 222 request()->has_upload()) { |
| 217 upload_progress_tracker_ = CreateUploadProgressTracker( | 223 upload_progress_tracker_ = CreateUploadProgressTracker( |
| 218 FROM_HERE, | 224 FROM_HERE, |
| 219 base::BindRepeating(&MojoAsyncResourceHandler::SendUploadProgress, | 225 base::BindRepeating(&MojoAsyncResourceHandler::SendUploadProgress, |
| 220 base::Unretained(this))); | 226 base::Unretained(this))); |
| 221 } | 227 } |
| 222 | 228 |
| 223 return true; | 229 controller->Resume(); |
| 224 } | 230 } |
| 225 | 231 |
| 226 bool MojoAsyncResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 232 bool MojoAsyncResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 227 int* buf_size, | 233 int* buf_size, |
| 228 int min_size) { | 234 int min_size) { |
| 229 DCHECK_EQ(-1, min_size); | 235 DCHECK_EQ(-1, min_size); |
| 230 | 236 |
| 237 // TODO(mmenke): Cancel with net::ERR_INSUFFICIENT_RESOURCES instead. |
| 231 if (!CheckForSufficientResource()) | 238 if (!CheckForSufficientResource()) |
| 232 return false; | 239 return false; |
| 233 | 240 |
| 234 if (!shared_writer_) { | 241 if (!shared_writer_) { |
| 235 MojoCreateDataPipeOptions options; | 242 MojoCreateDataPipeOptions options; |
| 236 options.struct_size = sizeof(MojoCreateDataPipeOptions); | 243 options.struct_size = sizeof(MojoCreateDataPipeOptions); |
| 237 options.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE; | 244 options.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE; |
| 238 options.element_num_bytes = 1; | 245 options.element_num_bytes = 1; |
| 239 options.capacity_num_bytes = g_allocation_size; | 246 options.capacity_num_bytes = g_allocation_size; |
| 240 mojo::DataPipe data_pipe(options); | 247 mojo::DataPipe data_pipe(options); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 267 is_using_io_buffer_not_from_writer_ = true; | 274 is_using_io_buffer_not_from_writer_ = true; |
| 268 buffer_ = new net::IOBufferWithSize(kMinAllocationSize); | 275 buffer_ = new net::IOBufferWithSize(kMinAllocationSize); |
| 269 } | 276 } |
| 270 | 277 |
| 271 DCHECK_EQ(0u, buffer_offset_); | 278 DCHECK_EQ(0u, buffer_offset_); |
| 272 *buf = buffer_; | 279 *buf = buffer_; |
| 273 *buf_size = buffer_->size(); | 280 *buf_size = buffer_->size(); |
| 274 return true; | 281 return true; |
| 275 } | 282 } |
| 276 | 283 |
| 277 bool MojoAsyncResourceHandler::OnReadCompleted(int bytes_read, bool* defer) { | 284 void MojoAsyncResourceHandler::OnReadCompleted( |
| 285 int bytes_read, |
| 286 std::unique_ptr<ResourceController> controller) { |
| 287 DCHECK(!has_controller()); |
| 278 DCHECK_GE(bytes_read, 0); | 288 DCHECK_GE(bytes_read, 0); |
| 279 DCHECK(buffer_); | 289 DCHECK(buffer_); |
| 280 | 290 |
| 281 if (!bytes_read) | 291 if (!bytes_read) { |
| 282 return true; | 292 controller->Resume(); |
| 293 return; |
| 294 } |
| 283 | 295 |
| 284 const ResourceRequestInfoImpl* info = GetRequestInfo(); | 296 const ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 285 if (info->ShouldReportRawHeaders()) { | 297 if (info->ShouldReportRawHeaders()) { |
| 286 auto transfer_size_diff = CalculateRecentlyReceivedBytes(); | 298 auto transfer_size_diff = CalculateRecentlyReceivedBytes(); |
| 287 if (transfer_size_diff > 0) | 299 if (transfer_size_diff > 0) |
| 288 url_loader_client_->OnTransferSizeUpdated(transfer_size_diff); | 300 url_loader_client_->OnTransferSizeUpdated(transfer_size_diff); |
| 289 } | 301 } |
| 290 | 302 |
| 291 if (response_body_consumer_handle_.is_valid()) { | 303 if (response_body_consumer_handle_.is_valid()) { |
| 292 // Send the data pipe on the first OnReadCompleted call. | 304 // Send the data pipe on the first OnReadCompleted call. |
| 293 url_loader_client_->OnStartLoadingResponseBody( | 305 url_loader_client_->OnStartLoadingResponseBody( |
| 294 std::move(response_body_consumer_handle_)); | 306 std::move(response_body_consumer_handle_)); |
| 295 response_body_consumer_handle_.reset(); | 307 response_body_consumer_handle_.reset(); |
| 296 } | 308 } |
| 297 | 309 |
| 298 if (is_using_io_buffer_not_from_writer_) { | 310 if (is_using_io_buffer_not_from_writer_) { |
| 299 // Couldn't allocate a buffer on the data pipe in OnWillRead. | 311 // Couldn't allocate a buffer on the data pipe in OnWillRead. |
| 300 DCHECK_EQ(0u, buffer_bytes_read_); | 312 DCHECK_EQ(0u, buffer_bytes_read_); |
| 301 buffer_bytes_read_ = bytes_read; | 313 buffer_bytes_read_ = bytes_read; |
| 302 if (!CopyReadDataToDataPipe(defer)) | 314 bool defer = false; |
| 303 return false; | 315 if (!CopyReadDataToDataPipe(&defer)) { |
| 304 if (*defer) { | 316 controller->Cancel(); |
| 317 return; |
| 318 } |
| 319 if (defer) { |
| 305 request()->LogBlockedBy("MojoAsyncResourceHandler"); | 320 request()->LogBlockedBy("MojoAsyncResourceHandler"); |
| 306 did_defer_on_writing_ = true; | 321 did_defer_on_writing_ = true; |
| 322 HoldController(std::move(controller)); |
| 323 return; |
| 307 } | 324 } |
| 308 return true; | 325 controller->Resume(); |
| 326 return; |
| 309 } | 327 } |
| 310 | 328 |
| 311 if (EndWrite(bytes_read) != MOJO_RESULT_OK) | 329 if (EndWrite(bytes_read) != MOJO_RESULT_OK) { |
| 312 return false; | 330 controller->Cancel(); |
| 331 return; |
| 332 } |
| 313 // Allocate a buffer for the next OnWillRead call here, because OnWillRead | 333 // Allocate a buffer for the next OnWillRead call here, because OnWillRead |
| 314 // doesn't have |defer| parameter. | 334 // doesn't have |defer| parameter. |
| 315 if (!AllocateWriterIOBuffer(&buffer_, defer)) | 335 bool defer = false; |
| 316 return false; | 336 if (!AllocateWriterIOBuffer(&buffer_, &defer)) { |
| 317 if (*defer) { | 337 controller->Cancel(); |
| 338 return; |
| 339 } |
| 340 if (defer) { |
| 318 request()->LogBlockedBy("MojoAsyncResourceHandler"); | 341 request()->LogBlockedBy("MojoAsyncResourceHandler"); |
| 319 did_defer_on_writing_ = true; | 342 did_defer_on_writing_ = true; |
| 343 HoldController(std::move(controller)); |
| 344 return; |
| 320 } | 345 } |
| 321 return true; | 346 |
| 347 controller->Resume(); |
| 322 } | 348 } |
| 323 | 349 |
| 324 void MojoAsyncResourceHandler::OnDataDownloaded(int bytes_downloaded) { | 350 void MojoAsyncResourceHandler::OnDataDownloaded(int bytes_downloaded) { |
| 325 url_loader_client_->OnDataDownloaded(bytes_downloaded, | 351 url_loader_client_->OnDataDownloaded(bytes_downloaded, |
| 326 CalculateRecentlyReceivedBytes()); | 352 CalculateRecentlyReceivedBytes()); |
| 327 } | 353 } |
| 328 | 354 |
| 329 void MojoAsyncResourceHandler::FollowRedirect() { | 355 void MojoAsyncResourceHandler::FollowRedirect() { |
| 330 if (!request()->status().is_success()) { | 356 if (!request()->status().is_success()) { |
| 331 DVLOG(1) << "FollowRedirect for invalid request"; | 357 DVLOG(1) << "FollowRedirect for invalid request"; |
| 332 return; | 358 return; |
| 333 } | 359 } |
| 334 if (!did_defer_on_redirect_) { | 360 if (!did_defer_on_redirect_) { |
| 335 DVLOG(1) << "Malformed FollowRedirect request"; | 361 DVLOG(1) << "Malformed FollowRedirect request"; |
| 336 ReportBadMessage("Malformed FollowRedirect request"); | 362 ReportBadMessage("Malformed FollowRedirect request"); |
| 337 return; | 363 return; |
| 338 } | 364 } |
| 339 | 365 |
| 340 DCHECK(!did_defer_on_writing_); | 366 DCHECK(!did_defer_on_writing_); |
| 341 did_defer_on_redirect_ = false; | 367 did_defer_on_redirect_ = false; |
| 342 request()->LogUnblocked(); | 368 request()->LogUnblocked(); |
| 343 controller()->Resume(); | 369 Resume(); |
| 344 } | 370 } |
| 345 | 371 |
| 346 void MojoAsyncResourceHandler::SetPriority(net::RequestPriority priority, | 372 void MojoAsyncResourceHandler::SetPriority(net::RequestPriority priority, |
| 347 int32_t intra_priority_value) { | 373 int32_t intra_priority_value) { |
| 348 ResourceDispatcherHostImpl::Get()->scheduler()->ReprioritizeRequest( | 374 ResourceDispatcherHostImpl::Get()->scheduler()->ReprioritizeRequest( |
| 349 request(), priority, intra_priority_value); | 375 request(), priority, intra_priority_value); |
| 350 } | 376 } |
| 351 | 377 |
| 352 void MojoAsyncResourceHandler::OnWritableForTesting() { | 378 void MojoAsyncResourceHandler::OnWritableForTesting() { |
| 353 OnWritable(MOJO_RESULT_OK); | 379 OnWritable(MOJO_RESULT_OK); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 370 return mojo::EndWriteDataRaw(shared_writer_->writer(), written); | 396 return mojo::EndWriteDataRaw(shared_writer_->writer(), written); |
| 371 } | 397 } |
| 372 | 398 |
| 373 net::IOBufferWithSize* MojoAsyncResourceHandler::GetResponseMetadata( | 399 net::IOBufferWithSize* MojoAsyncResourceHandler::GetResponseMetadata( |
| 374 net::URLRequest* request) { | 400 net::URLRequest* request) { |
| 375 return request->response_info().metadata.get(); | 401 return request->response_info().metadata.get(); |
| 376 } | 402 } |
| 377 | 403 |
| 378 void MojoAsyncResourceHandler::OnResponseCompleted( | 404 void MojoAsyncResourceHandler::OnResponseCompleted( |
| 379 const net::URLRequestStatus& status, | 405 const net::URLRequestStatus& status, |
| 380 bool* defer) { | 406 std::unique_ptr<ResourceController> controller) { |
| 381 // Ensure sending the final upload progress message here, since | 407 // Ensure sending the final upload progress message here, since |
| 382 // OnResponseCompleted can be called without OnResponseStarted on cancellation | 408 // OnResponseCompleted can be called without OnResponseStarted on cancellation |
| 383 // or error cases. | 409 // or error cases. |
| 384 if (upload_progress_tracker_) { | 410 if (upload_progress_tracker_) { |
| 385 upload_progress_tracker_->OnUploadCompleted(); | 411 upload_progress_tracker_->OnUploadCompleted(); |
| 386 upload_progress_tracker_ = nullptr; | 412 upload_progress_tracker_ = nullptr; |
| 387 } | 413 } |
| 388 | 414 |
| 389 shared_writer_ = nullptr; | 415 shared_writer_ = nullptr; |
| 390 buffer_ = nullptr; | 416 buffer_ = nullptr; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 412 ResourceRequestCompletionStatus request_complete_data; | 438 ResourceRequestCompletionStatus request_complete_data; |
| 413 request_complete_data.error_code = error_code; | 439 request_complete_data.error_code = error_code; |
| 414 request_complete_data.was_ignored_by_handler = was_ignored_by_handler; | 440 request_complete_data.was_ignored_by_handler = was_ignored_by_handler; |
| 415 request_complete_data.exists_in_cache = request()->response_info().was_cached; | 441 request_complete_data.exists_in_cache = request()->response_info().was_cached; |
| 416 request_complete_data.completion_time = base::TimeTicks::Now(); | 442 request_complete_data.completion_time = base::TimeTicks::Now(); |
| 417 request_complete_data.encoded_data_length = | 443 request_complete_data.encoded_data_length = |
| 418 request()->GetTotalReceivedBytes(); | 444 request()->GetTotalReceivedBytes(); |
| 419 request_complete_data.encoded_body_length = request()->GetRawBodyBytes(); | 445 request_complete_data.encoded_body_length = request()->GetRawBodyBytes(); |
| 420 | 446 |
| 421 url_loader_client_->OnComplete(request_complete_data); | 447 url_loader_client_->OnComplete(request_complete_data); |
| 448 controller->Resume(); |
| 422 } | 449 } |
| 423 | 450 |
| 424 bool MojoAsyncResourceHandler::CopyReadDataToDataPipe(bool* defer) { | 451 bool MojoAsyncResourceHandler::CopyReadDataToDataPipe(bool* defer) { |
| 425 while (true) { | 452 while (true) { |
| 426 scoped_refptr<net::IOBufferWithSize> dest; | 453 scoped_refptr<net::IOBufferWithSize> dest; |
| 427 if (!AllocateWriterIOBuffer(&dest, defer)) | 454 if (!AllocateWriterIOBuffer(&dest, defer)) |
| 428 return false; | 455 return false; |
| 429 if (*defer) | 456 if (*defer) |
| 430 return true; | 457 return true; |
| 431 if (buffer_bytes_read_ == 0) { | 458 if (buffer_bytes_read_ == 0) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 494 } |
| 468 | 495 |
| 469 bool MojoAsyncResourceHandler::CheckForSufficientResource() { | 496 bool MojoAsyncResourceHandler::CheckForSufficientResource() { |
| 470 if (has_checked_for_sufficient_resources_) | 497 if (has_checked_for_sufficient_resources_) |
| 471 return true; | 498 return true; |
| 472 has_checked_for_sufficient_resources_ = true; | 499 has_checked_for_sufficient_resources_ = true; |
| 473 | 500 |
| 474 if (rdh_->HasSufficientResourcesForRequest(request())) | 501 if (rdh_->HasSufficientResourcesForRequest(request())) |
| 475 return true; | 502 return true; |
| 476 | 503 |
| 477 controller()->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES); | |
| 478 return false; | 504 return false; |
| 479 } | 505 } |
| 480 | 506 |
| 481 void MojoAsyncResourceHandler::OnWritable(MojoResult result) { | 507 void MojoAsyncResourceHandler::OnWritable(MojoResult result) { |
| 482 if (!did_defer_on_writing_) | 508 if (!did_defer_on_writing_) |
| 483 return; | 509 return; |
| 510 DCHECK(has_controller()); |
| 484 DCHECK(!did_defer_on_redirect_); | 511 DCHECK(!did_defer_on_redirect_); |
| 485 did_defer_on_writing_ = false; | 512 did_defer_on_writing_ = false; |
| 486 | 513 |
| 487 if (is_using_io_buffer_not_from_writer_) { | 514 if (is_using_io_buffer_not_from_writer_) { |
| 488 // |buffer_| is set to a net::IOBufferWithSize. Write the buffer contents | 515 // |buffer_| is set to a net::IOBufferWithSize. Write the buffer contents |
| 489 // to the data pipe. | 516 // to the data pipe. |
| 490 DCHECK_GT(buffer_bytes_read_, 0u); | 517 DCHECK_GT(buffer_bytes_read_, 0u); |
| 491 if (!CopyReadDataToDataPipe(&did_defer_on_writing_)) { | 518 if (!CopyReadDataToDataPipe(&did_defer_on_writing_)) { |
| 492 controller()->CancelWithError(net::ERR_FAILED); | 519 CancelWithError(net::ERR_FAILED); |
| 493 return; | 520 return; |
| 494 } | 521 } |
| 495 } else { | 522 } else { |
| 496 // Allocate a buffer for the next OnWillRead call here. | 523 // Allocate a buffer for the next OnWillRead call here. |
| 497 if (!AllocateWriterIOBuffer(&buffer_, &did_defer_on_writing_)) { | 524 if (!AllocateWriterIOBuffer(&buffer_, &did_defer_on_writing_)) { |
| 498 controller()->CancelWithError(net::ERR_FAILED); | 525 CancelWithError(net::ERR_FAILED); |
| 499 return; | 526 return; |
| 500 } | 527 } |
| 501 } | 528 } |
| 502 | 529 |
| 503 if (did_defer_on_writing_) { | 530 if (did_defer_on_writing_) { |
| 504 // Continue waiting. | 531 // Continue waiting. |
| 505 return; | 532 return; |
| 506 } | 533 } |
| 507 request()->LogUnblocked(); | 534 request()->LogUnblocked(); |
| 508 controller()->Resume(); | 535 Resume(); |
| 509 } | 536 } |
| 510 | 537 |
| 511 void MojoAsyncResourceHandler::Cancel() { | 538 void MojoAsyncResourceHandler::Cancel() { |
| 512 const ResourceRequestInfoImpl* info = GetRequestInfo(); | 539 const ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 513 ResourceDispatcherHostImpl::Get()->CancelRequestFromRenderer( | 540 ResourceDispatcherHostImpl::Get()->CancelRequestFromRenderer( |
| 514 GlobalRequestID(info->GetChildID(), info->GetRequestID())); | 541 GlobalRequestID(info->GetChildID(), info->GetRequestID())); |
| 515 } | 542 } |
| 516 | 543 |
| 517 int64_t MojoAsyncResourceHandler::CalculateRecentlyReceivedBytes() { | 544 int64_t MojoAsyncResourceHandler::CalculateRecentlyReceivedBytes() { |
| 518 int64_t total_received_bytes = request()->GetTotalReceivedBytes(); | 545 int64_t total_received_bytes = request()->GetTotalReceivedBytes(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 base::Bind(&MojoAsyncResourceHandler::OnUploadProgressACK, | 579 base::Bind(&MojoAsyncResourceHandler::OnUploadProgressACK, |
| 553 weak_factory_.GetWeakPtr())); | 580 weak_factory_.GetWeakPtr())); |
| 554 } | 581 } |
| 555 | 582 |
| 556 void MojoAsyncResourceHandler::OnUploadProgressACK() { | 583 void MojoAsyncResourceHandler::OnUploadProgressACK() { |
| 557 if (upload_progress_tracker_) | 584 if (upload_progress_tracker_) |
| 558 upload_progress_tracker_->OnAckReceived(); | 585 upload_progress_tracker_->OnAckReceived(); |
| 559 } | 586 } |
| 560 | 587 |
| 561 } // namespace content | 588 } // namespace content |
| OLD | NEW |