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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 MojoAsyncResourceHandler::MojoAsyncResourceHandler( | 116 MojoAsyncResourceHandler::MojoAsyncResourceHandler( |
117 net::URLRequest* request, | 117 net::URLRequest* request, |
118 ResourceDispatcherHostImpl* rdh, | 118 ResourceDispatcherHostImpl* rdh, |
119 mojom::URLLoaderAssociatedRequest mojo_request, | 119 mojom::URLLoaderAssociatedRequest mojo_request, |
120 mojom::URLLoaderClientPtr url_loader_client, | 120 mojom::URLLoaderClientPtr url_loader_client, |
121 ResourceType resource_type) | 121 ResourceType resource_type) |
122 : ResourceHandler(request), | 122 : ResourceHandler(request), |
123 rdh_(rdh), | 123 rdh_(rdh), |
124 binding_(this, std::move(mojo_request)), | 124 binding_(this, std::move(mojo_request)), |
125 handle_watcher_(FROM_HERE), | 125 handle_watcher_(FROM_HERE, mojo::Watcher::ArmingPolicy::AUTOMATIC), |
126 url_loader_client_(std::move(url_loader_client)), | 126 url_loader_client_(std::move(url_loader_client)), |
127 weak_factory_(this) { | 127 weak_factory_(this) { |
128 DCHECK(url_loader_client_); | 128 DCHECK(url_loader_client_); |
129 InitializeResourceBufferConstants(); | 129 InitializeResourceBufferConstants(); |
130 // This unretained pointer is safe, because |binding_| is owned by |this| and | 130 // This unretained pointer is safe, because |binding_| is owned by |this| and |
131 // the callback will never be called after |this| is destroyed. | 131 // the callback will never be called after |this| is destroyed. |
132 binding_.set_connection_error_handler( | 132 binding_.set_connection_error_handler( |
133 base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this))); | 133 base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this))); |
134 | 134 |
135 if (IsResourceTypeFrame(resource_type)) { | 135 if (IsResourceTypeFrame(resource_type)) { |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 base::Bind(&MojoAsyncResourceHandler::OnUploadProgressACK, | 576 base::Bind(&MojoAsyncResourceHandler::OnUploadProgressACK, |
577 weak_factory_.GetWeakPtr())); | 577 weak_factory_.GetWeakPtr())); |
578 } | 578 } |
579 | 579 |
580 void MojoAsyncResourceHandler::OnUploadProgressACK() { | 580 void MojoAsyncResourceHandler::OnUploadProgressACK() { |
581 if (upload_progress_tracker_) | 581 if (upload_progress_tracker_) |
582 upload_progress_tracker_->OnAckReceived(); | 582 upload_progress_tracker_->OnAckReceived(); |
583 } | 583 } |
584 | 584 |
585 } // namespace content | 585 } // namespace content |
OLD | NEW |