Chromium Code Reviews| 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_CDM_PROMISE_ADAPTER_H_ | 5 #ifndef MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ |
| 6 #define MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ | 6 #define MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/synchronization/lock.h" | |
| 12 #include "media/base/cdm_promise.h" | 13 #include "media/base/cdm_promise.h" |
| 13 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
| 14 | 15 |
| 15 namespace media { | 16 namespace media { |
| 16 | 17 |
| 17 // Helps convert CdmPromises to an integer identifier and vice versa. The | 18 // Helps convert CdmPromises to an integer identifier and vice versa. The |
| 18 // integer identifier is needed where we cannot pass CdmPromises through, such | 19 // integer identifier is needed where we cannot pass CdmPromises through, such |
| 19 // as PPAPI, IPC and JNI. | 20 // as PPAPI, IPC and JNI. |
| 20 class MEDIA_EXPORT CdmPromiseAdapter { | 21 class MEDIA_EXPORT CdmPromiseAdapter { |
| 21 public: | 22 public: |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 44 // A map between promise IDs and CdmPromises. It owns the CdmPromises. | 45 // A map between promise IDs and CdmPromises. It owns the CdmPromises. |
| 45 typedef base::ScopedPtrHashMap<uint32_t, scoped_ptr<CdmPromise>> PromiseMap; | 46 typedef base::ScopedPtrHashMap<uint32_t, scoped_ptr<CdmPromise>> PromiseMap; |
| 46 | 47 |
| 47 // Finds, takes the ownership of and returns the promise for |promise_id|. | 48 // Finds, takes the ownership of and returns the promise for |promise_id|. |
| 48 // Returns null if no promise can be found. | 49 // Returns null if no promise can be found. |
| 49 scoped_ptr<CdmPromise> TakePromise(uint32_t promise_id); | 50 scoped_ptr<CdmPromise> TakePromise(uint32_t promise_id); |
| 50 | 51 |
| 51 uint32_t next_promise_id_; | 52 uint32_t next_promise_id_; |
| 52 PromiseMap promises_; | 53 PromiseMap promises_; |
| 53 | 54 |
| 55 base::Lock lock_; | |
|
Tima Vaisburd
2015/09/14 20:42:33
I need to recall why I need this lock. It would be
| |
| 56 | |
| 54 DISALLOW_COPY_AND_ASSIGN(CdmPromiseAdapter); | 57 DISALLOW_COPY_AND_ASSIGN(CdmPromiseAdapter); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 } // namespace media | 60 } // namespace media |
| 58 | 61 |
| 59 #endif // MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ | 62 #endif // MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ |
| OLD | NEW |