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

Unified Diff: net/base/server_bound_cert_service.h

Issue 11689002: Fix for spdy cancelling ServerBoundCertServiceRequest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: NET_EXPORT the RequestHandle Created 7 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/base/server_bound_cert_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/server_bound_cert_service.h
diff --git a/net/base/server_bound_cert_service.h b/net/base/server_bound_cert_service.h
index e02fbb8a4a4ad43f6a3b660a571e3e37a7303822..c8c9a05ba95835db4f777c31fa1e7e80601ca9bb 100644
--- a/net/base/server_bound_cert_service.h
+++ b/net/base/server_bound_cert_service.h
@@ -26,6 +26,7 @@ class TaskRunner;
namespace net {
class ServerBoundCertServiceJob;
+class ServerBoundCertServiceRequest;
class ServerBoundCertServiceWorker;
// A class for creating and fetching server bound certs.
@@ -34,8 +35,30 @@ class ServerBoundCertServiceWorker;
class NET_EXPORT ServerBoundCertService
: NON_EXPORTED_BASE(public base::NonThreadSafe) {
public:
- // Opaque type used to cancel a request.
- typedef void* RequestHandle;
+ class NET_EXPORT RequestHandle {
+ public:
+ RequestHandle();
+ ~RequestHandle();
+
+ // Cancel the request. Does nothing if the request finished or was already
+ // cancelled.
+ void Cancel();
+
+ bool is_active() const { return request_ != NULL; }
+
+ private:
+ friend class ServerBoundCertService;
+
+ void RequestStarted(ServerBoundCertService* service,
+ ServerBoundCertServiceRequest* request,
+ const CompletionCallback& callback);
+
+ void OnRequestComplete(int result);
+
+ ServerBoundCertService* service_;
+ ServerBoundCertServiceRequest* request_;
+ CompletionCallback callback_;
+ };
// Password used on EncryptedPrivateKeyInfo data stored in EC private_key
// values. (This is not used to provide any security, but to workaround NSS
@@ -78,8 +101,9 @@ class NET_EXPORT ServerBoundCertService
// could not be completed immediately, in which case the result code will
// be passed to the callback when available.
//
- // |*out_req| will be filled with a handle to the async request. This handle
- // is not valid after the request has completed.
+ // |*out_req| will be initialized with a handle to the async request. This
+ // RequestHandle object must be cancelled or destroyed before the
+ // ServerBoundCertService is destroyed.
int GetDomainBoundCert(
const std::string& origin,
const std::vector<uint8>& requested_types,
@@ -89,11 +113,6 @@ class NET_EXPORT ServerBoundCertService
const CompletionCallback& callback,
RequestHandle* out_req);
- // Cancels the specified request. |req| is the handle returned by
- // GetDomainBoundCert(). After a request is canceled, its completion
- // callback will not be called.
- void CancelRequest(RequestHandle req);
-
// Returns the backing ServerBoundCertStore.
ServerBoundCertStore* GetCertStore();
@@ -104,6 +123,11 @@ class NET_EXPORT ServerBoundCertService
uint64 inflight_joins() const { return inflight_joins_; }
private:
+ // Cancels the specified request. |req| is the handle stored by
+ // GetDomainBoundCert(). After a request is canceled, its completion
+ // callback will not be called.
+ void CancelRequest(ServerBoundCertServiceRequest* req);
+
void HandleResult(const std::string& server_identifier,
int error,
scoped_ptr<ServerBoundCertStore::ServerBoundCert> cert);
« no previous file with comments | « no previous file | net/base/server_bound_cert_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698