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

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

Issue 2444683002: Move MediaKeys::Exception to CdmPromise::Exception (Closed)
Patch Set: include "media/base/media_keys.h" Created 4 years, 1 month 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 | « media/base/cdm_promise.h ('k') | 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>
(...skipping 18 matching lines...) Expand all
29 uint32_t SavePromise(std::unique_ptr<media::CdmPromise> promise); 29 uint32_t SavePromise(std::unique_ptr<media::CdmPromise> promise);
30 30
31 // Takes the promise for |promise_id|, sanity checks its |type|, and resolves 31 // Takes the promise for |promise_id|, sanity checks its |type|, and resolves
32 // it with |result|. 32 // it with |result|.
33 template <typename... T> 33 template <typename... T>
34 void ResolvePromise(uint32_t promise_id, const T&... result); 34 void ResolvePromise(uint32_t promise_id, const T&... result);
35 35
36 // Takes the promise for |promise_id| and rejects it with |exception_code|, 36 // Takes the promise for |promise_id| and rejects it with |exception_code|,
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 MediaKeys::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. It owns the CdmPromises.
48 typedef base::ScopedPtrHashMap<uint32_t, std::unique_ptr<CdmPromise>> 48 typedef base::ScopedPtrHashMap<uint32_t, std::unique_ptr<CdmPromise>>
49 PromiseMap; 49 PromiseMap;
50 50
51 // Finds, takes the ownership of and returns the promise for |promise_id|. 51 // Finds, takes the ownership of and returns the promise for |promise_id|.
52 // Returns null if no promise can be found. 52 // Returns null if no promise can be found.
53 std::unique_ptr<CdmPromise> TakePromise(uint32_t promise_id); 53 std::unique_ptr<CdmPromise> TakePromise(uint32_t promise_id);
54 54
55 uint32_t next_promise_id_; 55 uint32_t next_promise_id_;
56 PromiseMap promises_; 56 PromiseMap promises_;
57 57
58 base::ThreadChecker thread_checker_; 58 base::ThreadChecker thread_checker_;
59 DISALLOW_COPY_AND_ASSIGN(CdmPromiseAdapter); 59 DISALLOW_COPY_AND_ASSIGN(CdmPromiseAdapter);
60 }; 60 };
61 61
62 } // namespace media 62 } // namespace media
63 63
64 #endif // MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ 64 #endif // MEDIA_BASE_CDM_PROMISE_ADAPTER_H_
OLDNEW
« no previous file with comments | « media/base/cdm_promise.h ('k') | media/base/cdm_promise_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698