OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 16 matching lines...) Expand all Loading... | |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef RTCCertificate_h | 31 #ifndef RTCCertificate_h |
32 #define RTCCertificate_h | 32 #define RTCCertificate_h |
33 | 33 |
34 #include "bindings/core/v8/ScriptWrappable.h" | 34 #include "bindings/core/v8/ScriptWrappable.h" |
35 #include "core/dom/DOMTimeStamp.h" | 35 #include "core/dom/DOMTimeStamp.h" |
36 #include "modules/ModulesExport.h" | 36 #include "modules/ModulesExport.h" |
37 #include "modules/peerconnection/RTCDtlsFingerprint.h" | |
37 #include "platform/heap/GarbageCollected.h" | 38 #include "platform/heap/GarbageCollected.h" |
39 #include "platform/wtf/Vector.h" | |
40 #include "platform/wtf/text/WTFString.h" | |
38 #include "public/platform/WebRTCCertificate.h" | 41 #include "public/platform/WebRTCCertificate.h" |
42 #include "v8/include/v8.h" | |
43 | |
39 #include <memory> | 44 #include <memory> |
40 | 45 |
41 namespace blink { | 46 namespace blink { |
42 | 47 |
48 class ScriptState; | |
49 | |
43 class MODULES_EXPORT RTCCertificate final | 50 class MODULES_EXPORT RTCCertificate final |
44 : public GarbageCollectedFinalized<RTCCertificate>, | 51 : public GarbageCollectedFinalized<RTCCertificate>, |
45 public ScriptWrappable { | 52 public ScriptWrappable { |
46 DEFINE_WRAPPERTYPEINFO(); | 53 DEFINE_WRAPPERTYPEINFO(); |
47 | 54 |
48 public: | 55 public: |
49 // Takes ownership of the certificate. | 56 // Takes ownership of the certificate. |
50 RTCCertificate(std::unique_ptr<WebRTCCertificate>); | 57 RTCCertificate(std::unique_ptr<WebRTCCertificate>); |
51 | 58 |
52 // Returns a new WebRTCCertificate shallow copy. | 59 // Returns a new WebRTCCertificate shallow copy. |
53 std::unique_ptr<WebRTCCertificate> CertificateShallowCopy() const; | 60 std::unique_ptr<WebRTCCertificate> CertificateShallowCopy() const; |
54 const WebRTCCertificate& Certificate() const { return *certificate_; } | 61 const WebRTCCertificate& Certificate() const { return *certificate_; } |
55 | 62 |
56 DEFINE_INLINE_TRACE() {} | 63 DEFINE_INLINE_TRACE() {} |
57 | 64 |
58 // Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z. | 65 // Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z. |
59 DOMTimeStamp expires() const; | 66 DOMTimeStamp expires() const; |
67 // Returns "FrozenArray<RTCDtlsFingerprint>" as per IDL. Because | |
68 // |RTCDtlsFingerprint| is a dictionary type, vectors of | |
69 // |RTCDtlsFingerprint| are not allowed (due to | |
70 // |DISALLOW_NEW_EXCEPT_PLACEMENT_NEW|). |toV8| is used to convert the | |
foolip
2017/04/21 16:51:53
This sound rather annoying and something that will
haraken
2017/04/21 19:59:16
Won't HeapVector<RTCDtlsFingerprint> work?
hbos_chromium
2017/04/24 10:35:31
It's annoying for anyone wanting to return any dat
| |
71 // |RTCDtlsFingerprint| objects to |v8::Value|s which can populate vectors. | |
72 Vector<v8::Local<v8::Value>> fingerprints(ScriptState*); | |
60 | 73 |
61 private: | 74 private: |
62 std::unique_ptr<WebRTCCertificate> certificate_; | 75 std::unique_ptr<WebRTCCertificate> certificate_; |
76 // Cache for the result of |fingerprints|. | |
77 Vector<v8::Global<v8::Value>> fingerprints_; | |
haraken
2017/04/20 13:21:54
This strong persistent handle will leak many thing
foolip
2017/04/21 16:51:53
Does this actually achieve the intended effect tho
haraken
2017/04/21 19:59:16
Yes, but the problem is that v8::Global<v8::Value>
hbos_chromium
2017/04/24 10:35:31
How could this create a cycle? It's a list of java
hbos_chromium
2017/04/24 10:41:09
What is this wrapper tracing thing you speak of?
I
| |
63 }; | 78 }; |
64 | 79 |
65 } // namespace blink | 80 } // namespace blink |
66 | 81 |
67 #endif // RTCCertificate_h | 82 #endif // RTCCertificate_h |
OLD | NEW |