OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BASE_BROWSER_CDM_H_ | 5 #ifndef MEDIA_BASE_BROWSER_CDM_H_ |
6 #define MEDIA_BASE_BROWSER_CDM_H_ | 6 #define MEDIA_BASE_BROWSER_CDM_H_ |
7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" |
8 #include "media/base/media_export.h" | 9 #include "media/base/media_export.h" |
9 #include "media/base/media_keys.h" | 10 #include "media/base/media_keys.h" |
10 #include "media/base/player_tracker.h" | 11 #include "media/base/player_tracker.h" |
11 | 12 |
12 namespace media { | 13 namespace media { |
13 | 14 |
14 // Interface for browser side CDMs. | 15 // Interface for browser side CDMs. |
15 class MEDIA_EXPORT BrowserCdm : public MediaKeys, public PlayerTracker { | 16 class MEDIA_EXPORT BrowserCdm : public MediaKeys, public PlayerTracker { |
16 public: | 17 public: |
17 ~BrowserCdm() override; | 18 ~BrowserCdm() override; |
18 | 19 |
| 20 // Virtual destructor. For most subclasses we can delete on the caller thread. |
| 21 virtual void DeleteOnCorrectThread(); |
| 22 |
19 protected: | 23 protected: |
20 BrowserCdm(); | 24 BrowserCdm(); |
21 | 25 |
22 private: | 26 private: |
23 DISALLOW_COPY_AND_ASSIGN(BrowserCdm); | 27 DISALLOW_COPY_AND_ASSIGN(BrowserCdm); |
24 }; | 28 }; |
25 | 29 |
| 30 struct MEDIA_EXPORT BrowserCdmDeleter { |
| 31 inline void operator()(BrowserCdm* ptr) const { |
| 32 ptr->DeleteOnCorrectThread(); |
| 33 } |
| 34 }; |
| 35 |
| 36 typedef scoped_ptr<BrowserCdm, BrowserCdmDeleter> BrowserCdmPtr; |
| 37 |
26 } // namespace media | 38 } // namespace media |
27 | 39 |
28 #endif // MEDIA_BASE_BROWSER_CDM_H_ | 40 #endif // MEDIA_BASE_BROWSER_CDM_H_ |
OLD | NEW |