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

Unified Diff: net/cert/internal/trust_store.h

Issue 2266333002: Allow TrustStore queries to be asynchronous. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 years, 4 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 | « net/cert/internal/path_builder_unittest.cc ('k') | net/cert/internal/trust_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/trust_store.h
diff --git a/net/cert/internal/trust_store.h b/net/cert/internal/trust_store.h
index e8706e78d1da765f8a9be8fe5ed394b66531ed80..2d02ac17c99cba356f4221fe94ccf43511226910 100644
--- a/net/cert/internal/trust_store.h
+++ b/net/cert/internal/trust_store.h
@@ -7,6 +7,7 @@
#include <vector>
+#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "net/base/net_export.h"
#include "net/cert/internal/parsed_certificate.h"
@@ -114,13 +115,35 @@ using TrustAnchors = std::vector<scoped_refptr<TrustAnchor>>;
// Interface for finding trust anchors.
class NET_EXPORT TrustStore {
public:
+ class NET_EXPORT Request {
+ public:
+ Request();
+ // Destruction of the Request cancels it.
+ virtual ~Request();
+ };
+
TrustStore();
virtual ~TrustStore();
- // Returns the trust anchors that match |name| in |*matches|, if any.
- virtual void FindTrustAnchorsByNormalizedName(
- const der::Input& normalized_name,
- TrustAnchors* matches) const = 0;
+ using TrustAnchorsCallback = base::Callback<void(TrustAnchors)>;
+
+ // Returns the trust anchors that match |cert|'s issuer name in
+ // |*synchronous_matches| and/or through |callback|. |cert| and
+ // |synchronous_matches| must not be null.
+ //
+ // If results are available synchronously, they will be appended to
+ // |*synchronous_matches|. |*synchronous_matches| will not be modified
+ // asynchronously.
+ //
+ // If |callback| is not null and results may be available asynchronously,
+ // |*out_req| will be filled with a Request, and |callback| will be called
+ // when results are available. The Request may be destroyed to cancel
+ // the callback if it has not occurred yet.
+ virtual void FindTrustAnchorsForCert(
+ const ParsedCertificate* cert,
+ const TrustAnchorsCallback& callback,
+ TrustAnchors* synchronous_matches,
+ std::unique_ptr<Request>* out_req) const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(TrustStore);
« no previous file with comments | « net/cert/internal/path_builder_unittest.cc ('k') | net/cert/internal/trust_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698