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

Unified Diff: net/cert/cert_net_fetcher.h

Issue 2595723002: Allow CertNetFetcher to be shutdown from the network thread (Closed)
Patch Set: update comments Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/cert/internal/cert_issuer_source_aia.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/cert_net_fetcher.h
diff --git a/net/cert/cert_net_fetcher.h b/net/cert/cert_net_fetcher.h
index 56a74948117db4f6ae95432dd9a721967a2cc0f3..2a45fe3b6f7407e944ee5b295b2739a7bdf84638 100644
--- a/net/cert/cert_net_fetcher.h
+++ b/net/cert/cert_net_fetcher.h
@@ -20,16 +20,15 @@ class GURL;
namespace net {
// CertNetFetcher is a synchronous interface for fetching AIA URLs and CRL
-// URLs.
+// URLs. It is shared between a caller thread (which starts and waits for
+// fetches), and a network thread (which does the actual fetches). It can be
+// shutdown from the network thread to cancel outstanding requests.
//
// A Request object is returned when starting a fetch. The consumer can
// use this as a handle for aborting the request (by freeing it), or reading
// the result of the request (WaitForResult)
-//
-// This interface is expected to be operated from a single thread.
-//
-// The CertNetFetcher must outlive all Request objects it creates.
-class NET_EXPORT CertNetFetcher {
+class NET_EXPORT CertNetFetcher
+ : public base::RefCountedThreadSafe<CertNetFetcher> {
public:
class Request {
public:
@@ -47,7 +46,12 @@ class NET_EXPORT CertNetFetcher {
CertNetFetcher() {}
- virtual ~CertNetFetcher() {}
+ // Shuts down the CertNetFetcher and cancels outstanding network requests. It
+ // is not guaranteed that any outstanding or subsequent
+ // Request::WaitForResult() calls will be completed. Shutdown() must be called
+ // from the network thread. It can be called more than once, but must be
+ // called before the CertNetFetcher is destroyed.
+ virtual void Shutdown() = 0;
// The Fetch*() methods start a request which can be cancelled by
// deleting the returned Request. Here is the meaning of the common
@@ -76,7 +80,11 @@ class NET_EXPORT CertNetFetcher {
int timeout_milliseconds,
int max_response_bytes) = 0;
+ protected:
+ virtual ~CertNetFetcher() {}
+
private:
+ friend class base::RefCountedThreadSafe<CertNetFetcher>;
DISALLOW_COPY_AND_ASSIGN(CertNetFetcher);
};
« no previous file with comments | « no previous file | net/cert/internal/cert_issuer_source_aia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698