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

Unified Diff: net/ssl/channel_id_service.h

Issue 1149083013: Combine ChannelIDService::RequestHandle and ChannelIDServiceRequest classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix order of variables Created 5 years, 6 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
Index: net/ssl/channel_id_service.h
diff --git a/net/ssl/channel_id_service.h b/net/ssl/channel_id_service.h
index a62260256e5cdfcead98eeb61ffb36c6f8442739..2ae15e3ac65394a7521b015fd2b90cb556c02721 100644
--- a/net/ssl/channel_id_service.h
+++ b/net/ssl/channel_id_service.h
@@ -29,7 +29,6 @@ class ECPrivateKey;
namespace net {
class ChannelIDServiceJob;
-class ChannelIDServiceRequest;
class ChannelIDServiceWorker;
// A class for creating and fetching Channel IDs.
@@ -39,29 +38,32 @@ class ChannelIDServiceWorker;
class NET_EXPORT ChannelIDService
: NON_EXPORTED_BASE(public base::NonThreadSafe) {
public:
- class NET_EXPORT RequestHandle {
+ class NET_EXPORT Request {
public:
- RequestHandle();
- ~RequestHandle();
+ Request();
+ ~Request();
// Cancel the request. Does nothing if the request finished or was already
// cancelled.
void Cancel();
- bool is_active() const { return request_ != NULL; }
+ bool is_active() const { return !callback_.is_null(); }
private:
friend class ChannelIDService;
+ friend class ChannelIDServiceJob;
void RequestStarted(ChannelIDService* service,
- ChannelIDServiceRequest* request,
- const CompletionCallback& callback);
+ base::TimeTicks request_start,
+ const CompletionCallback& callback,
+ scoped_ptr<crypto::ECPrivateKey>* key);
- void OnRequestComplete(int result);
+ void Post(int error, scoped_ptr<crypto::ECPrivateKey> key);
ChannelIDService* service_;
- ChannelIDServiceRequest* request_;
+ base::TimeTicks request_start_;
CompletionCallback callback_;
+ scoped_ptr<crypto::ECPrivateKey>* key_;
};
// Password used on EncryptedPrivateKeyInfo data stored in EC private_key
@@ -94,13 +96,11 @@ class NET_EXPORT ChannelIDService
// could not be completed immediately, in which case the result code will
// be passed to the callback when available.
//
- // |*out_req| will be initialized with a handle to the async request. This
- // RequestHandle object must be cancelled or destroyed before the
- // ChannelIDService is destroyed.
+ // |*out_req| will be initialized with a handle to the async request.
int GetOrCreateChannelID(const std::string& host,
scoped_ptr<crypto::ECPrivateKey>* key,
const CompletionCallback& callback,
- RequestHandle* out_req);
+ Request* out_req);
// Fetches the channel ID for the specified host if one exists.
// Returns OK if successful, ERR_FILE_NOT_FOUND if none exists, or an error
@@ -116,13 +116,11 @@ class NET_EXPORT ChannelIDService
// request arrives for the same domain, the GetChannelID request will
// not complete until a new channel ID is created.
//
- // |*out_req| will be initialized with a handle to the async request. This
- // RequestHandle object must be cancelled or destroyed before the
- // ChannelIDService is destroyed.
+ // |*out_req| will be initialized with a handle to the async request.
int GetChannelID(const std::string& host,
scoped_ptr<crypto::ECPrivateKey>* key,
const CompletionCallback& callback,
- RequestHandle* out_req);
+ Request* out_req);
// Returns the backing ChannelIDStore.
ChannelIDStore* GetChannelIDStore();
@@ -138,7 +136,7 @@ class NET_EXPORT ChannelIDService
// Cancels the specified request. |req| is the handle stored by
// GetChannelID(). After a request is canceled, its completion
// callback will not be called.
- void CancelRequest(ChannelIDServiceRequest* req);
+ void CancelRequest(Request* req);
void GotChannelID(int err,
const std::string& server_identifier,
@@ -159,7 +157,7 @@ class NET_EXPORT ChannelIDService
scoped_ptr<crypto::ECPrivateKey>* key,
bool create_if_missing,
const CompletionCallback& callback,
- RequestHandle* out_req);
+ Request* out_req);
// Looks for the channel ID for |domain| in this service's store.
// Returns OK if it can be found synchronously, ERR_IO_PENDING if the
@@ -170,7 +168,7 @@ class NET_EXPORT ChannelIDService
scoped_ptr<crypto::ECPrivateKey>* key,
bool create_if_missing,
const CompletionCallback& callback,
- RequestHandle* out_req);
+ Request* out_req);
scoped_ptr<ChannelIDStore> channel_id_store_;
scoped_refptr<base::TaskRunner> task_runner_;

Powered by Google App Engine
This is Rietveld 408576698