Chromium Code Reviews| 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..f6eff1220ee30c59adf9b4a9cc88bfd4ad88cecd 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,10 @@ 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. |
|
eroman
2017/01/11 01:56:59
Could you add some comments that answer the questi
estark
2017/01/12 01:06:30
Done.
|
| + 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 +78,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); |
| }; |