| 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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 void RejectPromise(uint32_t promise_id, | 35 void RejectPromise(uint32_t promise_id, |
| 36 MediaKeys::Exception exception_code, | 36 MediaKeys::Exception exception_code, |
| 37 uint32 system_code, | 37 uint32 system_code, |
| 38 const std::string& error_message); | 38 const std::string& error_message); |
| 39 | 39 |
| 40 // Rejects and clears all |promises_|. | 40 // Rejects and clears all |promises_|. |
| 41 void Clear(); | 41 void Clear(); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 // A map between promise IDs and CdmPromises. It owns the CdmPromises. | 44 // A map between promise IDs and CdmPromises. It owns the CdmPromises. |
| 45 typedef base::ScopedPtrHashMap<uint32_t, CdmPromise> PromiseMap; | 45 typedef base::ScopedPtrHashMap<uint32_t, scoped_ptr<CdmPromise>> PromiseMap; |
| 46 | 46 |
| 47 // Finds, takes the ownership of and returns the promise for |promise_id|. | 47 // Finds, takes the ownership of and returns the promise for |promise_id|. |
| 48 // Returns null if no promise can be found. | 48 // Returns null if no promise can be found. |
| 49 scoped_ptr<CdmPromise> TakePromise(uint32_t promise_id); | 49 scoped_ptr<CdmPromise> TakePromise(uint32_t promise_id); |
| 50 | 50 |
| 51 uint32_t next_promise_id_; | 51 uint32_t next_promise_id_; |
| 52 PromiseMap promises_; | 52 PromiseMap promises_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(CdmPromiseAdapter); | 54 DISALLOW_COPY_AND_ASSIGN(CdmPromiseAdapter); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace media | 57 } // namespace media |
| 58 | 58 |
| 59 #endif // MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ | 59 #endif // MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ |
| OLD | NEW |