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

Side by Side Diff: net/proxy/proxy_script_fetcher_impl.h

Issue 2845643003: Allow ProxyService to share URLRequestContext with everything else. (Closed)
Patch Set: Fix fetcher shutdown with no active request, add test, add comment Created 3 years, 7 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 | « net/proxy/proxy_script_fetcher.h ('k') | net/proxy/proxy_script_fetcher_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ 5 #ifndef NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_
6 #define NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ 6 #define NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 size_t SetSizeConstraint(size_t size_bytes); 46 size_t SetSizeConstraint(size_t size_bytes);
47 47
48 void OnResponseCompleted(URLRequest* request, int net_error); 48 void OnResponseCompleted(URLRequest* request, int net_error);
49 49
50 // ProxyScriptFetcher methods: 50 // ProxyScriptFetcher methods:
51 int Fetch(const GURL& url, 51 int Fetch(const GURL& url,
52 base::string16* text, 52 base::string16* text,
53 const CompletionCallback& callback) override; 53 const CompletionCallback& callback) override;
54 void Cancel() override; 54 void Cancel() override;
55 URLRequestContext* GetRequestContext() const override; 55 URLRequestContext* GetRequestContext() const override;
56 void OnShutdown() override;
56 57
57 // URLRequest::Delegate methods: 58 // URLRequest::Delegate methods:
58 void OnAuthRequired(URLRequest* request, 59 void OnAuthRequired(URLRequest* request,
59 AuthChallengeInfo* auth_info) override; 60 AuthChallengeInfo* auth_info) override;
60 void OnSSLCertificateError(URLRequest* request, 61 void OnSSLCertificateError(URLRequest* request,
61 const SSLInfo& ssl_info, 62 const SSLInfo& ssl_info,
62 bool is_hsts_ok) override; 63 bool is_hsts_ok) override;
63 void OnResponseStarted(URLRequest* request, int net_error) override; 64 void OnResponseStarted(URLRequest* request, int net_error) override;
64 void OnReadCompleted(URLRequest* request, int num_bytes) override; 65 void OnReadCompleted(URLRequest* request, int num_bytes) override;
65 66
(...skipping 10 matching lines...) Expand all
76 // Called once the request has completed to notify the caller of 77 // Called once the request has completed to notify the caller of
77 // |response_code_| and |response_text_|. 78 // |response_code_| and |response_text_|.
78 void FetchCompleted(); 79 void FetchCompleted();
79 80
80 // Clear out the state for the current request. 81 // Clear out the state for the current request.
81 void ResetCurRequestState(); 82 void ResetCurRequestState();
82 83
83 // Callback for time-out task of request with id |id|. 84 // Callback for time-out task of request with id |id|.
84 void OnTimeout(int id); 85 void OnTimeout(int id);
85 86
86 // The context used for making network requests. 87 // The context used for making network requests. Set to nullptr by
87 URLRequestContext* const url_request_context_; 88 // OnShutdown.
89 URLRequestContext* url_request_context_;
88 90
89 // Buffer that URLRequest writes into. 91 // Buffer that URLRequest writes into.
90 scoped_refptr<IOBuffer> buf_; 92 scoped_refptr<IOBuffer> buf_;
91 93
92 // The next ID to use for |cur_request_| (monotonically increasing). 94 // The next ID to use for |cur_request_| (monotonically increasing).
93 int next_id_; 95 int next_id_;
94 96
95 // The current (in progress) request, or NULL. 97 // The current (in progress) request, or NULL.
96 std::unique_ptr<URLRequest> cur_request_; 98 std::unique_ptr<URLRequest> cur_request_;
97 99
(...skipping 30 matching lines...) Expand all
128 // Factory for creating the time-out task. This takes care of revoking 130 // Factory for creating the time-out task. This takes care of revoking
129 // outstanding tasks when |this| is deleted. 131 // outstanding tasks when |this| is deleted.
130 base::WeakPtrFactory<ProxyScriptFetcherImpl> weak_factory_; 132 base::WeakPtrFactory<ProxyScriptFetcherImpl> weak_factory_;
131 133
132 DISALLOW_COPY_AND_ASSIGN(ProxyScriptFetcherImpl); 134 DISALLOW_COPY_AND_ASSIGN(ProxyScriptFetcherImpl);
133 }; 135 };
134 136
135 } // namespace net 137 } // namespace net
136 138
137 #endif // NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ 139 #endif // NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_
OLDNEW
« no previous file with comments | « net/proxy/proxy_script_fetcher.h ('k') | net/proxy/proxy_script_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698