| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 MojoAsyncResourceHandler::MojoAsyncResourceHandler( | 107 MojoAsyncResourceHandler::MojoAsyncResourceHandler( |
| 108 net::URLRequest* request, | 108 net::URLRequest* request, |
| 109 ResourceDispatcherHostImpl* rdh, | 109 ResourceDispatcherHostImpl* rdh, |
| 110 mojom::URLLoaderAssociatedRequest mojo_request, | 110 mojom::URLLoaderAssociatedRequest mojo_request, |
| 111 mojom::URLLoaderClientAssociatedPtr url_loader_client) | 111 mojom::URLLoaderClientAssociatedPtr url_loader_client) |
| 112 : ResourceHandler(request), | 112 : ResourceHandler(request), |
| 113 rdh_(rdh), | 113 rdh_(rdh), |
| 114 binding_(this, std::move(mojo_request)), | 114 binding_(this, std::move(mojo_request)), |
| 115 handle_watcher_(FROM_HERE), |
| 115 url_loader_client_(std::move(url_loader_client)), | 116 url_loader_client_(std::move(url_loader_client)), |
| 116 weak_factory_(this) { | 117 weak_factory_(this) { |
| 117 DCHECK(url_loader_client_); | 118 DCHECK(url_loader_client_); |
| 118 InitializeResourceBufferConstants(); | 119 InitializeResourceBufferConstants(); |
| 119 // This unretained pointer is safe, because |binding_| is owned by |this| and | 120 // This unretained pointer is safe, because |binding_| is owned by |this| and |
| 120 // the callback will never be called after |this| is destroyed. | 121 // the callback will never be called after |this| is destroyed. |
| 121 binding_.set_connection_error_handler( | 122 binding_.set_connection_error_handler( |
| 122 base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this))); | 123 base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this))); |
| 123 | 124 |
| 124 GetRequestInfo()->set_on_transfer(base::Bind( | 125 GetRequestInfo()->set_on_transfer(base::Bind( |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 mojom::URLLoaderAssociatedRequest mojo_request, | 472 mojom::URLLoaderAssociatedRequest mojo_request, |
| 472 mojom::URLLoaderClientAssociatedPtr url_loader_client) { | 473 mojom::URLLoaderClientAssociatedPtr url_loader_client) { |
| 473 binding_.Unbind(); | 474 binding_.Unbind(); |
| 474 binding_.Bind(std::move(mojo_request)); | 475 binding_.Bind(std::move(mojo_request)); |
| 475 binding_.set_connection_error_handler( | 476 binding_.set_connection_error_handler( |
| 476 base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this))); | 477 base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this))); |
| 477 url_loader_client_ = std::move(url_loader_client); | 478 url_loader_client_ = std::move(url_loader_client); |
| 478 } | 479 } |
| 479 | 480 |
| 480 } // namespace content | 481 } // namespace content |
| OLD | NEW |