OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/renderer/media/webcontentdecryptionmodulesession_impl.h" | 5 #include "content/renderer/media/webcontentdecryptionmodulesession_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "content/renderer/media/cdm_session_adapter.h" | 12 #include "content/renderer/media/cdm_session_adapter.h" |
13 #include "media/base/cdm_promise.h" | 13 #include "media/base/cdm_promise.h" |
14 #include "third_party/WebKit/public/platform/WebURL.h" | 14 #include "third_party/WebKit/public/platform/WebURL.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 const char kCreateSessionUMAName[] = "CreateSession"; | 18 const char kCreateSessionUMAName[] = "CreateSession"; |
19 | 19 |
20 // For backwards compatibility with blink not using | 20 // For backwards compatibility with blink not using |
21 // WebContentDecryptionModuleResult, reserve an index for |outstanding_results_| | 21 // WebContentDecryptionModuleResult, reserve an index for |outstanding_results_| |
22 // that will not be used when adding a WebContentDecryptionModuleResult. | 22 // that will not be used when adding a WebContentDecryptionModuleResult. |
23 // TODO(jrummell): Remove once blink always uses | 23 // TODO(jrummell): Remove once blink always uses |
24 // WebContentDecryptionModuleResult. | 24 // WebContentDecryptionModuleResult. |
25 const uint32 kReservedIndex = 0; | 25 const uint32 kReservedIndex = 0; |
26 | 26 |
27 static blink::WebContentDecryptionModuleException ConvertException( | |
28 media::MediaKeys::Exception exception_code) { | |
29 switch (exception_code) { | |
30 case media::MediaKeys::NOT_SUPPORTED_ERROR: | |
31 return blink::WebContentDecryptionModuleExceptionNotSupportedError; | |
32 case media::MediaKeys::INVALID_STATE_ERROR: | |
33 return blink::WebContentDecryptionModuleExceptionInvalidStateError; | |
34 case media::MediaKeys::INVALID_ACCESS_ERROR: | |
35 return blink::WebContentDecryptionModuleExceptionInvalidAccessError; | |
36 case media::MediaKeys::QUOTA_EXCEEDED_ERROR: | |
37 return blink::WebContentDecryptionModuleExceptionQuotaExceededError; | |
38 case media::MediaKeys::UNKNOWN_ERROR: | |
39 return blink::WebContentDecryptionModuleExceptionUnknownError; | |
40 case media::MediaKeys::CLIENT_ERROR: | |
41 return blink::WebContentDecryptionModuleExceptionClientError; | |
42 case media::MediaKeys::OUTPUT_ERROR: | |
43 return blink::WebContentDecryptionModuleExceptionOutputError; | |
44 default: | |
45 NOTREACHED(); | |
46 return blink::WebContentDecryptionModuleExceptionUnknownError; | |
47 } | |
48 } | |
49 | |
50 WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( | 27 WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( |
51 const scoped_refptr<CdmSessionAdapter>& adapter) | 28 const scoped_refptr<CdmSessionAdapter>& adapter) |
52 : adapter_(adapter), | 29 : adapter_(adapter), |
53 is_closed_(false), | 30 is_closed_(false), |
54 next_available_result_index_(1), | |
55 weak_ptr_factory_(this) { | 31 weak_ptr_factory_(this) { |
56 } | 32 } |
57 | 33 |
58 WebContentDecryptionModuleSessionImpl:: | 34 WebContentDecryptionModuleSessionImpl:: |
59 ~WebContentDecryptionModuleSessionImpl() { | 35 ~WebContentDecryptionModuleSessionImpl() { |
60 if (!web_session_id_.empty()) | 36 if (!web_session_id_.empty()) |
61 adapter_->RemoveSession(web_session_id_); | 37 adapter_->UnregisterSession(web_session_id_); |
62 | |
63 // Release any WebContentDecryptionModuleResult objects that are left. Their | |
64 // index will have been passed down via a CdmPromise, but it uses a WeakPtr. | |
65 DLOG_IF(WARNING, outstanding_results_.size() > 0) | |
66 << "Clearing " << outstanding_results_.size() << " results"; | |
67 for (ResultMap::iterator it = outstanding_results_.begin(); | |
68 it != outstanding_results_.end(); | |
69 ++it) { | |
70 it->second.completeWithError( | |
71 blink::WebContentDecryptionModuleExceptionInvalidStateError, | |
72 0, | |
73 "Outstanding request being cancelled."); | |
74 } | |
75 outstanding_results_.clear(); | |
76 } | 38 } |
77 | 39 |
78 void WebContentDecryptionModuleSessionImpl::setClientInterface(Client* client) { | 40 void WebContentDecryptionModuleSessionImpl::setClientInterface(Client* client) { |
79 client_ = client; | 41 client_ = client; |
80 } | 42 } |
81 | 43 |
82 blink::WebString WebContentDecryptionModuleSessionImpl::sessionId() const { | 44 blink::WebString WebContentDecryptionModuleSessionImpl::sessionId() const { |
83 return blink::WebString::fromUTF8(web_session_id_); | 45 return blink::WebString::fromUTF8(web_session_id_); |
84 } | 46 } |
85 | 47 |
(...skipping 13 matching lines...) Expand all Loading... | |
99 // http://crbug.com/385874 | 61 // http://crbug.com/385874 |
100 std::string content_type = base::StringToLowerASCII(init_data_type_as_ascii); | 62 std::string content_type = base::StringToLowerASCII(init_data_type_as_ascii); |
101 if (content_type == "audio/mp4" || content_type == "video/mp4") { | 63 if (content_type == "audio/mp4" || content_type == "video/mp4") { |
102 init_data_type_as_ascii = "cenc"; | 64 init_data_type_as_ascii = "cenc"; |
103 } else if (content_type == "audio/webm" || content_type == "video/webm") { | 65 } else if (content_type == "audio/webm" || content_type == "video/webm") { |
104 init_data_type_as_ascii = "webm"; | 66 init_data_type_as_ascii = "webm"; |
105 } | 67 } |
106 | 68 |
107 scoped_ptr<media::NewSessionCdmPromise> promise( | 69 scoped_ptr<media::NewSessionCdmPromise> promise( |
108 new media::NewSessionCdmPromise( | 70 new media::NewSessionCdmPromise( |
109 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionCreated, | 71 base::Bind( |
110 weak_ptr_factory_.GetWeakPtr(), | 72 &WebContentDecryptionModuleSessionImpl::OnSessionInitialized, |
111 kReservedIndex), | 73 weak_ptr_factory_.GetWeakPtr(), |
74 kReservedIndex), | |
112 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionError, | 75 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionError, |
113 weak_ptr_factory_.GetWeakPtr()), | 76 weak_ptr_factory_.GetWeakPtr()), |
114 adapter_->GetKeySystemUMAPrefix() + kCreateSessionUMAName)); | 77 adapter_->GetKeySystemUMAPrefix() + kCreateSessionUMAName)); |
115 adapter_->InitializeNewSession(init_data_type_as_ascii, | 78 adapter_->InitializeNewSession(init_data_type_as_ascii, |
116 init_data, | 79 init_data, |
117 init_data_length, | 80 init_data_length, |
118 media::MediaKeys::TEMPORARY_SESSION, | 81 media::MediaKeys::TEMPORARY_SESSION, |
119 promise.Pass()); | 82 promise.Pass()); |
120 } | 83 } |
121 | 84 |
122 void WebContentDecryptionModuleSessionImpl::update(const uint8* response, | 85 void WebContentDecryptionModuleSessionImpl::update(const uint8* response, |
123 size_t response_length) { | 86 size_t response_length) { |
124 DCHECK(response); | 87 DCHECK(response); |
125 scoped_ptr<media::SimpleCdmPromise> promise(new media::SimpleCdmPromise( | 88 scoped_ptr<media::SimpleCdmPromise> promise(new media::SimpleCdmPromise( |
126 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionReady, | 89 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionReady, |
127 weak_ptr_factory_.GetWeakPtr()), | 90 weak_ptr_factory_.GetWeakPtr()), |
128 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionError, | 91 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionError, |
129 weak_ptr_factory_.GetWeakPtr()))); | 92 weak_ptr_factory_.GetWeakPtr()))); |
130 adapter_->UpdateSession( | 93 adapter_->UpdateSession( |
131 web_session_id_, response, response_length, promise.Pass()); | 94 web_session_id_, response, response_length, promise.Pass()); |
132 } | 95 } |
133 | 96 |
134 void WebContentDecryptionModuleSessionImpl::release() { | 97 void WebContentDecryptionModuleSessionImpl::release() { |
135 scoped_ptr<media::SimpleCdmPromise> promise(new media::SimpleCdmPromise( | 98 scoped_ptr<media::SimpleCdmPromise> promise(new media::SimpleCdmPromise( |
136 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionClosed, | 99 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionClosed, |
137 weak_ptr_factory_.GetWeakPtr()), | 100 weak_ptr_factory_.GetWeakPtr()), |
138 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionError, | 101 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionError, |
139 weak_ptr_factory_.GetWeakPtr()))); | 102 weak_ptr_factory_.GetWeakPtr()))); |
140 adapter_->ReleaseSession(web_session_id_, promise.Pass()); | 103 adapter_->CloseSession(web_session_id_, promise.Pass()); |
ddorwin
2014/09/17 23:54:34
If this is never called, NOTREACHED()?
jrummell
2014/09/23 01:42:48
Updated all 3 old methods to NOTREACHED().
| |
141 } | 104 } |
142 | 105 |
143 void WebContentDecryptionModuleSessionImpl::initializeNewSession( | 106 void WebContentDecryptionModuleSessionImpl::initializeNewSession( |
144 const blink::WebString& init_data_type, | 107 const blink::WebString& init_data_type, |
145 const uint8* init_data, | 108 const uint8* init_data, |
146 size_t init_data_length, | 109 size_t init_data_length, |
147 const blink::WebString& session_type, | 110 const blink::WebString& session_type, |
148 blink::WebContentDecryptionModuleResult result) { | 111 blink::WebContentDecryptionModuleResult result) { |
149 uint32 result_index = AddResult(result); | 112 uint32 result_index = outstanding_results_.AddResult(result); |
150 | 113 |
151 // TODO(ddorwin): Guard against this in supported types check and remove this. | 114 // TODO(ddorwin): Guard against this in supported types check and remove this. |
152 // Chromium only supports ASCII MIME types. | 115 // Chromium only supports ASCII MIME types. |
153 if (!base::IsStringASCII(init_data_type)) { | 116 if (!base::IsStringASCII(init_data_type)) { |
154 NOTREACHED(); | 117 NOTREACHED(); |
155 SessionError(result_index, | 118 OnPromiseRejected(result_index, |
156 media::MediaKeys::NOT_SUPPORTED_ERROR, | 119 media::MediaKeys::NOT_SUPPORTED_ERROR, |
157 0, | 120 0, |
158 "The initialization data type " + init_data_type.utf8() + | 121 "The initialization data type " + init_data_type.utf8() + |
159 " is not supported by the key system."); | 122 " is not supported by the key system."); |
160 return; | 123 return; |
161 } | 124 } |
162 | 125 |
163 std::string init_data_type_as_ascii = base::UTF16ToASCII(init_data_type); | 126 std::string init_data_type_as_ascii = base::UTF16ToASCII(init_data_type); |
164 DLOG_IF(WARNING, init_data_type_as_ascii.find('/') != std::string::npos) | 127 DLOG_IF(WARNING, init_data_type_as_ascii.find('/') != std::string::npos) |
165 << "init_data_type '" << init_data_type_as_ascii | 128 << "init_data_type '" << init_data_type_as_ascii |
166 << "' may be a MIME type"; | 129 << "' may be a MIME type"; |
167 | 130 |
168 scoped_ptr<media::NewSessionCdmPromise> promise( | 131 scoped_ptr<media::NewSessionCdmPromise> promise( |
ddorwin
2014/09/17 23:54:34
For consistency (and less code here), does it make
jrummell
2014/09/23 01:42:48
Done.
| |
169 new media::NewSessionCdmPromise( | 132 new media::NewSessionCdmPromise( |
170 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionCreated, | 133 base::Bind( |
171 weak_ptr_factory_.GetWeakPtr(), | 134 &WebContentDecryptionModuleSessionImpl::OnSessionInitialized, |
172 result_index), | 135 weak_ptr_factory_.GetWeakPtr(), |
173 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionError, | 136 result_index), |
137 base::Bind(&WebContentDecryptionModuleSessionImpl::OnPromiseRejected, | |
174 weak_ptr_factory_.GetWeakPtr(), | 138 weak_ptr_factory_.GetWeakPtr(), |
175 result_index), | 139 result_index), |
176 adapter_->GetKeySystemUMAPrefix() + kCreateSessionUMAName)); | 140 adapter_->GetKeySystemUMAPrefix() + kCreateSessionUMAName)); |
177 adapter_->InitializeNewSession(init_data_type_as_ascii, | 141 adapter_->InitializeNewSession(init_data_type_as_ascii, |
178 init_data, | 142 init_data, |
179 init_data_length, | 143 init_data_length, |
180 media::MediaKeys::TEMPORARY_SESSION, | 144 media::MediaKeys::TEMPORARY_SESSION, |
181 promise.Pass()); | 145 promise.Pass()); |
182 } | 146 } |
183 | 147 |
184 void WebContentDecryptionModuleSessionImpl::update( | 148 void WebContentDecryptionModuleSessionImpl::update( |
185 const uint8* response, | 149 const uint8* response, |
186 size_t response_length, | 150 size_t response_length, |
187 blink::WebContentDecryptionModuleResult result) { | 151 blink::WebContentDecryptionModuleResult result) { |
188 DCHECK(response); | 152 DCHECK(response); |
189 uint32 result_index = AddResult(result); | 153 scoped_ptr<media::SimpleCdmPromise> promise = |
190 scoped_ptr<media::SimpleCdmPromise> promise(new media::SimpleCdmPromise( | 154 outstanding_results_.CreateSimpleCdmPromise(result); |
191 base::Bind( | |
192 &WebContentDecryptionModuleSessionImpl::SessionUpdatedOrReleased, | |
193 weak_ptr_factory_.GetWeakPtr(), | |
194 result_index), | |
195 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionError, | |
196 weak_ptr_factory_.GetWeakPtr(), | |
197 result_index))); | |
198 adapter_->UpdateSession( | 155 adapter_->UpdateSession( |
199 web_session_id_, response, response_length, promise.Pass()); | 156 web_session_id_, response, response_length, promise.Pass()); |
200 } | 157 } |
201 | 158 |
159 void WebContentDecryptionModuleSessionImpl::close( | |
160 blink::WebContentDecryptionModuleResult result) { | |
161 scoped_ptr<media::SimpleCdmPromise> promise = | |
162 outstanding_results_.CreateSimpleCdmPromise(result); | |
163 adapter_->CloseSession(web_session_id_, promise.Pass()); | |
164 } | |
165 | |
166 void WebContentDecryptionModuleSessionImpl::remove( | |
167 blink::WebContentDecryptionModuleResult result) { | |
168 scoped_ptr<media::SimpleCdmPromise> promise = | |
169 outstanding_results_.CreateSimpleCdmPromise(result); | |
170 adapter_->RemoveSession(web_session_id_, promise.Pass()); | |
171 } | |
172 | |
173 void WebContentDecryptionModuleSessionImpl::getUsableKeyIds( | |
174 blink::WebContentDecryptionModuleResult result) { | |
175 scoped_ptr<media::KeyIdsPromise> promise = | |
176 outstanding_results_.CreateKeyIdsPromise(result); | |
177 adapter_->GetUsableKeyIds(web_session_id_, promise.Pass()); | |
178 } | |
179 | |
202 void WebContentDecryptionModuleSessionImpl::release( | 180 void WebContentDecryptionModuleSessionImpl::release( |
203 blink::WebContentDecryptionModuleResult result) { | 181 blink::WebContentDecryptionModuleResult result) { |
204 uint32 result_index = AddResult(result); | 182 scoped_ptr<media::SimpleCdmPromise> promise = |
205 scoped_ptr<media::SimpleCdmPromise> promise(new media::SimpleCdmPromise( | 183 outstanding_results_.CreateSimpleCdmPromise(result); |
206 base::Bind( | 184 adapter_->CloseSession(web_session_id_, promise.Pass()); |
207 &WebContentDecryptionModuleSessionImpl::SessionUpdatedOrReleased, | |
208 weak_ptr_factory_.GetWeakPtr(), | |
209 result_index), | |
210 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionError, | |
211 weak_ptr_factory_.GetWeakPtr(), | |
212 result_index))); | |
213 adapter_->ReleaseSession(web_session_id_, promise.Pass()); | |
214 } | 185 } |
215 | 186 |
216 void WebContentDecryptionModuleSessionImpl::OnSessionMessage( | 187 void WebContentDecryptionModuleSessionImpl::OnSessionMessage( |
217 const std::vector<uint8>& message, | 188 const std::vector<uint8>& message, |
218 const GURL& destination_url) { | 189 const GURL& destination_url) { |
219 DCHECK(client_) << "Client not set before message event"; | 190 DCHECK(client_) << "Client not set before message event"; |
220 client_->message( | 191 client_->message( |
221 message.empty() ? NULL : &message[0], message.size(), destination_url); | 192 message.empty() ? NULL : &message[0], message.size(), destination_url); |
222 } | 193 } |
223 | 194 |
195 void WebContentDecryptionModuleSessionImpl::OnSessionKeysChange( | |
196 bool has_additional_usable_key) { | |
197 // TODO(jrummell): Update this once Blink client supports this. | |
198 } | |
199 | |
200 void WebContentDecryptionModuleSessionImpl::OnSessionExpirationChange( | |
201 double new_expiry_time) { | |
202 // TODO(jrummell): Update this once Blink client supports this. | |
203 } | |
204 | |
224 void WebContentDecryptionModuleSessionImpl::OnSessionReady() { | 205 void WebContentDecryptionModuleSessionImpl::OnSessionReady() { |
225 client_->ready(); | 206 client_->ready(); |
226 } | 207 } |
227 | 208 |
228 void WebContentDecryptionModuleSessionImpl::OnSessionClosed() { | 209 void WebContentDecryptionModuleSessionImpl::OnSessionClosed() { |
229 if (!is_closed_) { | 210 if (!is_closed_) { |
230 is_closed_ = true; | 211 is_closed_ = true; |
231 client_->close(); | 212 client_->close(); |
232 } | 213 } |
233 } | 214 } |
(...skipping 10 matching lines...) Expand all Loading... | |
244 client_->error(Client::MediaKeyErrorCodeClient, system_code); | 225 client_->error(Client::MediaKeyErrorCodeClient, system_code); |
245 break; | 226 break; |
246 default: | 227 default: |
247 // This will include all other CDM4 errors and any error generated | 228 // This will include all other CDM4 errors and any error generated |
248 // by CDM5 or later. | 229 // by CDM5 or later. |
249 client_->error(Client::MediaKeyErrorCodeUnknown, system_code); | 230 client_->error(Client::MediaKeyErrorCodeUnknown, system_code); |
250 break; | 231 break; |
251 } | 232 } |
252 } | 233 } |
253 | 234 |
254 void WebContentDecryptionModuleSessionImpl::SessionCreated( | 235 void WebContentDecryptionModuleSessionImpl::OnSessionInitialized( |
255 uint32 result_index, | 236 uint32 result_index, |
ddorwin
2014/09/17 23:54:34
This code doesn't care about result_index. This is
jrummell
2014/09/23 01:42:48
Although the status is needed. Done.
| |
256 const std::string& web_session_id) { | 237 const std::string& web_session_id) { |
257 blink::WebContentDecryptionModuleResult::SessionStatus status; | 238 blink::WebContentDecryptionModuleResult::SessionStatus status; |
258 | 239 |
259 // CDM will return NULL if the session to be loaded can't be found. | 240 // CDM will return NULL if the session to be loaded can't be found. |
260 if (web_session_id.empty()) { | 241 if (web_session_id.empty()) { |
261 status = blink::WebContentDecryptionModuleResult::SessionNotFound; | 242 status = blink::WebContentDecryptionModuleResult::SessionNotFound; |
ddorwin
2014/09/17 23:54:34
But doesn't this code only exist for that? Let's a
jrummell
2014/09/23 01:42:48
I see. You're assuming that load() sets web_sessio
| |
262 } else { | 243 } else { |
263 DCHECK(web_session_id_.empty()) | 244 DCHECK(web_session_id_.empty()) |
264 << "Session ID may not be changed once set."; | 245 << "Session ID may not be changed once set."; |
265 web_session_id_ = web_session_id; | 246 web_session_id_ = web_session_id; |
266 status = | 247 status = |
267 adapter_->RegisterSession(web_session_id_, | 248 adapter_->RegisterSession(web_session_id_, |
268 weak_ptr_factory_.GetWeakPtr()) | 249 weak_ptr_factory_.GetWeakPtr()) |
269 ? blink::WebContentDecryptionModuleResult::NewSession | 250 ? blink::WebContentDecryptionModuleResult::NewSession |
270 : blink::WebContentDecryptionModuleResult::SessionAlreadyExists; | 251 : blink::WebContentDecryptionModuleResult::SessionAlreadyExists; |
271 } | 252 } |
272 | 253 |
273 ResultMap::iterator it = outstanding_results_.find(result_index); | 254 outstanding_results_.CompleteWithSession(result_index, status); |
274 if (it != outstanding_results_.end()) { | |
275 blink::WebContentDecryptionModuleResult& result = it->second; | |
276 result.completeWithSession(status); | |
277 outstanding_results_.erase(result_index); | |
278 } | |
279 } | 255 } |
280 | 256 |
281 void WebContentDecryptionModuleSessionImpl::SessionUpdatedOrReleased( | 257 void WebContentDecryptionModuleSessionImpl::OnPromiseRejected( |
ddorwin
2014/09/17 23:54:34
It would be nice for this to go away as well (rela
jrummell
2014/09/23 01:42:48
Done.
| |
282 uint32 result_index) { | |
283 ResultMap::iterator it = outstanding_results_.find(result_index); | |
284 DCHECK(it != outstanding_results_.end()); | |
285 blink::WebContentDecryptionModuleResult& result = it->second; | |
286 result.complete(); | |
287 outstanding_results_.erase(it); | |
288 } | |
289 | |
290 void WebContentDecryptionModuleSessionImpl::SessionError( | |
291 uint32 result_index, | 258 uint32 result_index, |
292 media::MediaKeys::Exception exception_code, | 259 media::MediaKeys::Exception exception_code, |
293 uint32 system_code, | 260 uint32 system_code, |
294 const std::string& error_message) { | 261 const std::string& error_message) { |
295 ResultMap::iterator it = outstanding_results_.find(result_index); | 262 outstanding_results_.CompleteWithError( |
296 DCHECK(it != outstanding_results_.end()); | 263 result_index, exception_code, system_code, error_message); |
297 blink::WebContentDecryptionModuleResult& result = it->second; | |
298 result.completeWithError(ConvertException(exception_code), | |
299 system_code, | |
300 blink::WebString::fromUTF8(error_message)); | |
301 outstanding_results_.erase(it); | |
302 } | |
303 | |
304 uint32 WebContentDecryptionModuleSessionImpl::AddResult( | |
305 blink::WebContentDecryptionModuleResult result) { | |
306 uint32 result_index = next_available_result_index_++; | |
307 DCHECK(result_index != kReservedIndex); | |
308 outstanding_results_.insert(std::make_pair(result_index, result)); | |
309 return result_index; | |
310 } | 264 } |
311 | 265 |
312 } // namespace content | 266 } // namespace content |
OLD | NEW |