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

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

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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
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_H_ 5 #ifndef MEDIA_BASE_CDM_PROMISE_H_
6 #define MEDIA_BASE_CDM_PROMISE_H_ 6 #define MEDIA_BASE_CDM_PROMISE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h"
11 #include "base/logging.h" 10 #include "base/logging.h"
12 #include "media/base/media_export.h" 11 #include "media/base/media_export.h"
13 #include "media/base/media_keys.h" 12 #include "media/base/media_keys.h"
14 13
15 namespace media { 14 namespace media {
16 15
17 // Interface for promises being resolved/rejected in response to various 16 // Interface for promises being resolved/rejected in response to various
18 // session actions. These may be called synchronously or asynchronously. 17 // session actions. These may be called synchronously or asynchronously.
19 // The promise must be resolved or rejected exactly once. It is expected that 18 // The promise must be resolved or rejected exactly once. It is expected that
20 // the caller free the promise once it is resolved/rejected. 19 // the caller free the promise once it is resolved/rejected.
(...skipping 17 matching lines...) Expand all
38 }; 37 };
39 38
40 CdmPromise(); 39 CdmPromise();
41 virtual ~CdmPromise(); 40 virtual ~CdmPromise();
42 41
43 // Used to indicate that the operation failed. |exception_code| must be 42 // Used to indicate that the operation failed. |exception_code| must be
44 // specified. |system_code| is a Key System-specific value for the error 43 // specified. |system_code| is a Key System-specific value for the error
45 // that occurred, or 0 if there is no associated status code or such status 44 // that occurred, or 0 if there is no associated status code or such status
46 // codes are not supported by the Key System. |error_message| is optional. 45 // codes are not supported by the Key System. |error_message| is optional.
47 virtual void reject(MediaKeys::Exception exception_code, 46 virtual void reject(MediaKeys::Exception exception_code,
48 uint32 system_code, 47 uint32_t system_code,
49 const std::string& error_message) = 0; 48 const std::string& error_message) = 0;
50 49
51 // Used to determine the template type of CdmPromiseTemplate<T> so that 50 // Used to determine the template type of CdmPromiseTemplate<T> so that
52 // saved CdmPromise objects can be cast to the correct templated version. 51 // saved CdmPromise objects can be cast to the correct templated version.
53 virtual ResolveParameterType GetResolveParameterType() const = 0; 52 virtual ResolveParameterType GetResolveParameterType() const = 0;
54 53
55 private: 54 private:
56 DISALLOW_COPY_AND_ASSIGN(CdmPromise); 55 DISALLOW_COPY_AND_ASSIGN(CdmPromise);
57 }; 56 };
58 57
(...skipping 23 matching lines...) Expand all
82 class MEDIA_EXPORT CdmPromiseTemplate : public CdmPromise { 81 class MEDIA_EXPORT CdmPromiseTemplate : public CdmPromise {
83 public: 82 public:
84 CdmPromiseTemplate() : is_settled_(false) {} 83 CdmPromiseTemplate() : is_settled_(false) {}
85 84
86 virtual ~CdmPromiseTemplate() { DCHECK(is_settled_); } 85 virtual ~CdmPromiseTemplate() { DCHECK(is_settled_); }
87 86
88 virtual void resolve(const T&... result) = 0; 87 virtual void resolve(const T&... result) = 0;
89 88
90 // CdmPromise implementation. 89 // CdmPromise implementation.
91 virtual void reject(MediaKeys::Exception exception_code, 90 virtual void reject(MediaKeys::Exception exception_code,
92 uint32 system_code, 91 uint32_t system_code,
93 const std::string& error_message) = 0; 92 const std::string& error_message) = 0;
94 93
95 ResolveParameterType GetResolveParameterType() const override { 94 ResolveParameterType GetResolveParameterType() const override {
96 return CdmPromiseTraits<T...>::kType; 95 return CdmPromiseTraits<T...>::kType;
97 } 96 }
98 97
99 protected: 98 protected:
100 // All implementations must call this method in resolve() and reject() methods 99 // All implementations must call this method in resolve() and reject() methods
101 // to indicate that the promise has been settled. 100 // to indicate that the promise has been settled.
102 void MarkPromiseSettled() { 101 void MarkPromiseSettled() {
103 // Promise can only be settled once. 102 // Promise can only be settled once.
104 DCHECK(!is_settled_); 103 DCHECK(!is_settled_);
105 is_settled_ = true; 104 is_settled_ = true;
106 } 105 }
107 106
108 private: 107 private:
109 // Keep track of whether the promise has been resolved or rejected yet. 108 // Keep track of whether the promise has been resolved or rejected yet.
110 bool is_settled_; 109 bool is_settled_;
111 110
112 DISALLOW_COPY_AND_ASSIGN(CdmPromiseTemplate); 111 DISALLOW_COPY_AND_ASSIGN(CdmPromiseTemplate);
113 }; 112 };
114 113
115 } // namespace media 114 } // namespace media
116 115
117 #endif // MEDIA_BASE_CDM_PROMISE_H_ 116 #endif // MEDIA_BASE_CDM_PROMISE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698