Make sure webrtc::VideoSourceInterface is released on the main render thread.
[chromium-blink-merge.git] / content / public / browser / signed_certificate_timestamp_store.h
blob753c1ada81d946bbece2aa0aa3c64d0535b33ab7
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_SIGNED_CERTIFICATE_TIMESTAMP_STORE_H_
6 #define CONTENT_PUBLIC_BROWSER_SIGNED_CERTIFICATE_TIMESTAMP_STORE_H_
8 #include "base/memory/ref_counted.h"
9 #include "content/common/content_export.h"
11 namespace net {
12 namespace ct {
13 struct SignedCertificateTimestamp;
14 } // namespace ct
15 } // namespace net
17 namespace content {
19 // The purpose of the SignedCertificateTimestampStore is to provide an easy way
20 // to store/retrieve SignedCertificateTimestamp objects. When stored,
21 // SignedCertificateTimestamp objects are associated with a RenderProcessHost.
22 // If all the RenderProcessHosts associated with the SCT have exited, the SCT
23 // is removed from the store. This class is used by the SSLManager to keep
24 // track of the SCTs associated with loaded resources. It can be accessed from
25 // the UI and IO threads (it is thread-safe). Note that the SCT ids will
26 // overflow if we register more than 2^32 - 1 SCTs in 1 browsing session (which
27 // is highly unlikely to happen).
28 class SignedCertificateTimestampStore {
29 public:
30 // Returns the singleton instance of the SignedCertificateTimestampStore.
31 CONTENT_EXPORT static SignedCertificateTimestampStore* GetInstance();
33 // Stores the specified SCT and returns the id associated with it. The SCT
34 // is associated with the specified RenderProcessHost.
35 // When all the RenderProcessHosts associated with a SCT have exited, the
36 // SCT is removed from the store.
37 // Note: ids start at 1.
38 virtual int Store(net::ct::SignedCertificateTimestamp* sct,
39 int render_process_host_id) = 0;
41 // Tries to retrieve the previously stored SCT associated with the specified
42 // |sct_id|. Returns whether the SCT could be found, and, if |sct| is
43 // non-NULL, copies it in.
44 virtual bool Retrieve(
45 int sct_id, scoped_refptr<net::ct::SignedCertificateTimestamp>* sct) = 0;
47 protected:
48 virtual ~SignedCertificateTimestampStore() {}
51 } // namespace content
53 #endif // CONTENT_PUBLIC_BROWSER_SIGNED_CERTIFICATE_TIMESTAMP_STORE_H_