| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CONTENT_NETWORK_URL_LOADER_IMPL_H_ | 5 #ifndef CONTENT_NETWORK_URL_LOADER_IMPL_H_ |
| 6 #define CONTENT_NETWORK_URL_LOADER_IMPL_H_ | 6 #define CONTENT_NETWORK_URL_LOADER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/common/url_loader.mojom.h" | 14 #include "content/common/url_loader.mojom.h" |
| 15 #include "mojo/public/cpp/bindings/associated_binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 16 #include "mojo/public/cpp/system/simple_watcher.h" | 16 #include "mojo/public/cpp/system/simple_watcher.h" |
| 17 #include "net/traffic_annotation/network_traffic_annotation.h" | 17 #include "net/traffic_annotation/network_traffic_annotation.h" |
| 18 #include "net/url_request/url_request.h" | 18 #include "net/url_request/url_request.h" |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class NetworkContext; | 22 class NetworkContext; |
| 23 class NetToMojoPendingBuffer; | 23 class NetToMojoPendingBuffer; |
| 24 | 24 |
| 25 class CONTENT_EXPORT URLLoaderImpl : public mojom::URLLoader, | 25 class CONTENT_EXPORT URLLoaderImpl : public mojom::URLLoader, |
| 26 public net::URLRequest::Delegate { | 26 public net::URLRequest::Delegate { |
| 27 public: | 27 public: |
| 28 URLLoaderImpl(NetworkContext* context, | 28 URLLoaderImpl(NetworkContext* context, |
| 29 mojom::URLLoaderAssociatedRequest url_loader_request, | 29 mojom::URLLoaderRequest url_loader_request, |
| 30 int32_t options, | 30 int32_t options, |
| 31 const ResourceRequest& request, | 31 const ResourceRequest& request, |
| 32 mojom::URLLoaderClientPtr url_loader_client, | 32 mojom::URLLoaderClientPtr url_loader_client, |
| 33 const net::NetworkTrafficAnnotationTag& traffic_annotation); | 33 const net::NetworkTrafficAnnotationTag& traffic_annotation); |
| 34 ~URLLoaderImpl() override; | 34 ~URLLoaderImpl() override; |
| 35 | 35 |
| 36 // Called when the associated NetworkContext is going away. | 36 // Called when the associated NetworkContext is going away. |
| 37 void Cleanup(); | 37 void Cleanup(); |
| 38 | 38 |
| 39 // mojom::URLLoader implementation: | 39 // mojom::URLLoader implementation: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 57 void NotifyCompleted(int error_code); | 57 void NotifyCompleted(int error_code); |
| 58 void OnConnectionError(); | 58 void OnConnectionError(); |
| 59 void OnResponseBodyStreamClosed(MojoResult result); | 59 void OnResponseBodyStreamClosed(MojoResult result); |
| 60 void OnResponseBodyStreamReady(MojoResult result); | 60 void OnResponseBodyStreamReady(MojoResult result); |
| 61 void DeleteIfNeeded(); | 61 void DeleteIfNeeded(); |
| 62 | 62 |
| 63 NetworkContext* context_; | 63 NetworkContext* context_; |
| 64 int32_t options_; | 64 int32_t options_; |
| 65 bool connected_; | 65 bool connected_; |
| 66 std::unique_ptr<net::URLRequest> url_request_; | 66 std::unique_ptr<net::URLRequest> url_request_; |
| 67 mojo::AssociatedBinding<mojom::URLLoader> binding_; | 67 mojo::Binding<mojom::URLLoader> binding_; |
| 68 mojom::URLLoaderClientPtr url_loader_client_; | 68 mojom::URLLoaderClientPtr url_loader_client_; |
| 69 | 69 |
| 70 mojo::ScopedDataPipeProducerHandle response_body_stream_; | 70 mojo::ScopedDataPipeProducerHandle response_body_stream_; |
| 71 scoped_refptr<NetToMojoPendingBuffer> pending_write_; | 71 scoped_refptr<NetToMojoPendingBuffer> pending_write_; |
| 72 mojo::SimpleWatcher writable_handle_watcher_; | 72 mojo::SimpleWatcher writable_handle_watcher_; |
| 73 mojo::SimpleWatcher peer_closed_handle_watcher_; | 73 mojo::SimpleWatcher peer_closed_handle_watcher_; |
| 74 | 74 |
| 75 base::WeakPtrFactory<URLLoaderImpl> weak_ptr_factory_; | 75 base::WeakPtrFactory<URLLoaderImpl> weak_ptr_factory_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(URLLoaderImpl); | 77 DISALLOW_COPY_AND_ASSIGN(URLLoaderImpl); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace content | 80 } // namespace content |
| 81 | 81 |
| 82 #endif // CONTENT_NETWORK_URL_LOADER_IMPL_H_ | 82 #endif // CONTENT_NETWORK_URL_LOADER_IMPL_H_ |
| OLD | NEW |