| 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> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 void SetPriority(net::RequestPriority priority, | 41 void SetPriority(net::RequestPriority priority, |
| 42 int32_t intra_priority_value) override; | 42 int32_t intra_priority_value) override; |
| 43 | 43 |
| 44 // net::URLRequest::Delegate methods: | 44 // net::URLRequest::Delegate methods: |
| 45 void OnReceivedRedirect(net::URLRequest* url_request, | 45 void OnReceivedRedirect(net::URLRequest* url_request, |
| 46 const net::RedirectInfo& redirect_info, | 46 const net::RedirectInfo& redirect_info, |
| 47 bool* defer_redirect) override; | 47 bool* defer_redirect) override; |
| 48 void OnResponseStarted(net::URLRequest* url_request, int net_error) override; | 48 void OnResponseStarted(net::URLRequest* url_request, int net_error) override; |
| 49 void OnReadCompleted(net::URLRequest* url_request, int bytes_read) override; | 49 void OnReadCompleted(net::URLRequest* url_request, int bytes_read) override; |
| 50 | 50 |
| 51 // Returns a WeakPtr so tests can validate that the object was destroyed. |
| 52 base::WeakPtr<URLLoaderImpl> GetWeakPtrForTests(); |
| 53 |
| 51 private: | 54 private: |
| 52 void ReadMore(); | 55 void ReadMore(); |
| 53 void DidRead(uint32_t num_bytes, bool completed_synchronously); | 56 void DidRead(uint32_t num_bytes, bool completed_synchronously); |
| 54 void NotifyCompleted(int error_code); | 57 void NotifyCompleted(int error_code); |
| 55 void OnConnectionError(); | 58 void OnConnectionError(); |
| 56 void OnResponseBodyStreamClosed(MojoResult result); | 59 void OnResponseBodyStreamClosed(MojoResult result); |
| 57 void OnResponseBodyStreamReady(MojoResult result); | 60 void OnResponseBodyStreamReady(MojoResult result); |
| 58 void DeleteIfNeeded(); | 61 void DeleteIfNeeded(); |
| 59 | 62 |
| 60 NetworkContext* context_; | 63 NetworkContext* context_; |
| 61 int32_t options_; | 64 int32_t options_; |
| 62 bool connected_; | 65 bool connected_; |
| 63 std::unique_ptr<net::URLRequest> url_request_; | 66 std::unique_ptr<net::URLRequest> url_request_; |
| 64 mojo::AssociatedBinding<mojom::URLLoader> binding_; | 67 mojo::AssociatedBinding<mojom::URLLoader> binding_; |
| 65 mojom::URLLoaderClientPtr url_loader_client_; | 68 mojom::URLLoaderClientPtr url_loader_client_; |
| 66 | 69 |
| 67 mojo::ScopedDataPipeProducerHandle response_body_stream_; | 70 mojo::ScopedDataPipeProducerHandle response_body_stream_; |
| 68 scoped_refptr<NetToMojoPendingBuffer> pending_write_; | 71 scoped_refptr<NetToMojoPendingBuffer> pending_write_; |
| 69 mojo::SimpleWatcher writable_handle_watcher_; | 72 mojo::SimpleWatcher writable_handle_watcher_; |
| 70 mojo::SimpleWatcher peer_closed_handle_watcher_; | 73 mojo::SimpleWatcher peer_closed_handle_watcher_; |
| 71 | 74 |
| 72 base::WeakPtrFactory<URLLoaderImpl> weak_ptr_factory_; | 75 base::WeakPtrFactory<URLLoaderImpl> weak_ptr_factory_; |
| 73 | 76 |
| 74 DISALLOW_COPY_AND_ASSIGN(URLLoaderImpl); | 77 DISALLOW_COPY_AND_ASSIGN(URLLoaderImpl); |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 } // namespace content | 80 } // namespace content |
| 78 | 81 |
| 79 #endif // CONTENT_NETWORK_URL_LOADER_IMPL_H_ | 82 #endif // CONTENT_NETWORK_URL_LOADER_IMPL_H_ |
| OLD | NEW |