Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: content/network/url_loader_impl.h

Issue 2951293002: NetworkService: Destroy URLLoaders when a NetworkContext is destroyed. (Closed)
Patch Set: Response to comment, change why destruction is safe Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/network/network_context.cc ('k') | content/network/url_loader_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « content/network/network_context.cc ('k') | content/network/url_loader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698