| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 MojoAsyncResourceHandler::MojoAsyncResourceHandler( | 115 MojoAsyncResourceHandler::MojoAsyncResourceHandler( |
| 116 net::URLRequest* request, | 116 net::URLRequest* request, |
| 117 ResourceDispatcherHostImpl* rdh, | 117 ResourceDispatcherHostImpl* rdh, |
| 118 mojom::URLLoaderAssociatedRequest mojo_request, | 118 mojom::URLLoaderAssociatedRequest mojo_request, |
| 119 mojom::URLLoaderClientAssociatedPtr url_loader_client, | 119 mojom::URLLoaderClientAssociatedPtr url_loader_client, |
| 120 ResourceType resource_type) | 120 ResourceType resource_type) |
| 121 : ResourceHandler(request), | 121 : ResourceHandler(request), |
| 122 rdh_(rdh), | 122 rdh_(rdh), |
| 123 binding_(this, std::move(mojo_request)), | 123 binding_(this, std::move(mojo_request)), |
| 124 handle_watcher_(FROM_HERE), |
| 124 url_loader_client_(std::move(url_loader_client)), | 125 url_loader_client_(std::move(url_loader_client)), |
| 125 weak_factory_(this) { | 126 weak_factory_(this) { |
| 126 DCHECK(url_loader_client_); | 127 DCHECK(url_loader_client_); |
| 127 InitializeResourceBufferConstants(); | 128 InitializeResourceBufferConstants(); |
| 128 // This unretained pointer is safe, because |binding_| is owned by |this| and | 129 // This unretained pointer is safe, because |binding_| is owned by |this| and |
| 129 // the callback will never be called after |this| is destroyed. | 130 // the callback will never be called after |this| is destroyed. |
| 130 binding_.set_connection_error_handler( | 131 binding_.set_connection_error_handler( |
| 131 base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this))); | 132 base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this))); |
| 132 | 133 |
| 133 if (IsResourceTypeFrame(resource_type)) { | 134 if (IsResourceTypeFrame(resource_type)) { |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 base::Bind(&MojoAsyncResourceHandler::OnUploadProgressACK, | 545 base::Bind(&MojoAsyncResourceHandler::OnUploadProgressACK, |
| 545 weak_factory_.GetWeakPtr())); | 546 weak_factory_.GetWeakPtr())); |
| 546 } | 547 } |
| 547 | 548 |
| 548 void MojoAsyncResourceHandler::OnUploadProgressACK() { | 549 void MojoAsyncResourceHandler::OnUploadProgressACK() { |
| 549 if (upload_progress_tracker_) | 550 if (upload_progress_tracker_) |
| 550 upload_progress_tracker_->OnAckReceived(); | 551 upload_progress_tracker_->OnAckReceived(); |
| 551 } | 552 } |
| 552 | 553 |
| 553 } // namespace content | 554 } // namespace content |
| OLD | NEW |