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

Side by Side Diff: media/blink/webcontentdecryptionmodule_impl.h

Issue 2402563002: Keep reference to CDM to avoid it's premature destruction (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ 5 #ifndef MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
6 #define MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ 6 #define MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // blink::WebContentDecryptionModule implementation. 47 // blink::WebContentDecryptionModule implementation.
48 blink::WebContentDecryptionModuleSession* createSession() override; 48 blink::WebContentDecryptionModuleSession* createSession() override;
49 49
50 void setServerCertificate( 50 void setServerCertificate(
51 const uint8_t* server_certificate, 51 const uint8_t* server_certificate,
52 size_t server_certificate_length, 52 size_t server_certificate_length,
53 blink::WebContentDecryptionModuleResult result) override; 53 blink::WebContentDecryptionModuleResult result) override;
54 54
55 // Returns the CdmContext associated with this CDM, which must not be nullptr. 55 // Returns the CdmContext associated with this CDM, which must not be nullptr.
56 // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor 56 // Caller should keep a reference using GetCdmAdapterReference() to keep the
57 // after WebContentDecryptionModule is freed. http://crbug.com/330324 57 // CDM alive if necessary.
58 CdmContext* GetCdmContext(); 58 CdmContext* GetCdmContext();
59 59
60 // Returns a reference to this CDM adapter.
61 CdmSessionAdapter* GetCdmAdapterReference();
xhwang 2016/10/07 05:02:14 This returns a raw pointer, not a reference... Ah,
jrummell 2016/10/07 20:15:30 Done.
62
60 private: 63 private:
61 friend CdmSessionAdapter; 64 friend CdmSessionAdapter;
62 65
63 // Takes reference to |adapter|. 66 // Takes reference to |adapter|.
64 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter); 67 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter);
65 68
66 scoped_refptr<CdmSessionAdapter> adapter_; 69 scoped_refptr<CdmSessionAdapter> adapter_;
67 70
68 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); 71 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl);
69 }; 72 };
70 73
71 // Allow typecasting from blink type as this is the only implementation. 74 // Allow typecasting from blink type as this is the only implementation.
72 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( 75 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl(
73 blink::WebContentDecryptionModule* cdm) { 76 blink::WebContentDecryptionModule* cdm) {
74 return static_cast<WebContentDecryptionModuleImpl*>(cdm); 77 return static_cast<WebContentDecryptionModuleImpl*>(cdm);
75 } 78 }
76 79
77 } // namespace media 80 } // namespace media
78 81
79 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ 82 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | media/blink/webcontentdecryptionmodule_impl.cc » ('j') | media/blink/webmediaplayer_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698