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

Side by Side Diff: media/base/cdm_promise_adapter.h

Issue 2600603002: Remove base::ScopedPtrHashMap from media/. (Closed)
Patch Set: rev Created 3 years, 12 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
« no previous file with comments | « no previous file | media/base/cdm_promise_adapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <unordered_map>
11 12
12 #include "base/containers/scoped_ptr_hash_map.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "media/base/cdm_promise.h" 15 #include "media/base/cdm_promise.h"
16 #include "media/base/media_export.h" 16 #include "media/base/media_export.h"
17 17
18 namespace media { 18 namespace media {
19 19
20 // Helps convert CdmPromises to an integer identifier and vice versa. The 20 // Helps convert CdmPromises to an integer identifier and vice versa. The
21 // integer identifier is needed where we cannot pass CdmPromises through, such 21 // integer identifier is needed where we cannot pass CdmPromises through, such
22 // as PPAPI, IPC and JNI. 22 // as PPAPI, IPC and JNI.
(...skipping 14 matching lines...) Expand all
37 // |system_code| and |error_message|. 37 // |system_code| and |error_message|.
38 void RejectPromise(uint32_t promise_id, 38 void RejectPromise(uint32_t promise_id,
39 CdmPromise::Exception exception_code, 39 CdmPromise::Exception exception_code,
40 uint32_t system_code, 40 uint32_t system_code,
41 const std::string& error_message); 41 const std::string& error_message);
42 42
43 // Rejects and clears all |promises_|. 43 // Rejects and clears all |promises_|.
44 void Clear(); 44 void Clear();
45 45
46 private: 46 private:
47 // A map between promise IDs and CdmPromises. It owns the CdmPromises. 47 // A map between promise IDs and CdmPromises.
48 typedef base::ScopedPtrHashMap<uint32_t, std::unique_ptr<CdmPromise>> 48 using PromiseMap = std::unordered_map<uint32_t, std::unique_ptr<CdmPromise>>;
49 PromiseMap;
50 49
51 // Finds, takes the ownership of and returns the promise for |promise_id|. 50 // Finds, takes the ownership of and returns the promise for |promise_id|.
52 // Returns null if no promise can be found. 51 // Returns null if no promise can be found.
53 std::unique_ptr<CdmPromise> TakePromise(uint32_t promise_id); 52 std::unique_ptr<CdmPromise> TakePromise(uint32_t promise_id);
54 53
55 uint32_t next_promise_id_; 54 uint32_t next_promise_id_;
56 PromiseMap promises_; 55 PromiseMap promises_;
57 56
58 base::ThreadChecker thread_checker_; 57 base::ThreadChecker thread_checker_;
59 DISALLOW_COPY_AND_ASSIGN(CdmPromiseAdapter); 58 DISALLOW_COPY_AND_ASSIGN(CdmPromiseAdapter);
60 }; 59 };
61 60
62 } // namespace media 61 } // namespace media
63 62
64 #endif // MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ 63 #endif // MEDIA_BASE_CDM_PROMISE_ADAPTER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/cdm_promise_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698