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

Side by Side Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 1102363005: Initialize the CDM asynchronously (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create() changes Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/pepper/content_decryptor_delegate.h" 5 #include "content/renderer/pepper/content_decryptor_delegate.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/metrics/sparse_histogram.h" 9 #include "base/metrics/sparse_histogram.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 void ContentDecryptorDelegate::Initialize( 376 void ContentDecryptorDelegate::Initialize(
377 const std::string& key_system, 377 const std::string& key_system,
378 bool allow_distinctive_identifier, 378 bool allow_distinctive_identifier,
379 bool allow_persistent_state, 379 bool allow_persistent_state,
380 const media::SessionMessageCB& session_message_cb, 380 const media::SessionMessageCB& session_message_cb,
381 const media::SessionClosedCB& session_closed_cb, 381 const media::SessionClosedCB& session_closed_cb,
382 const media::LegacySessionErrorCB& legacy_session_error_cb, 382 const media::LegacySessionErrorCB& legacy_session_error_cb,
383 const media::SessionKeysChangeCB& session_keys_change_cb, 383 const media::SessionKeysChangeCB& session_keys_change_cb,
384 const media::SessionExpirationUpdateCB& session_expiration_update_cb, 384 const media::SessionExpirationUpdateCB& session_expiration_update_cb,
385 const base::Closure& fatal_plugin_error_cb) { 385 const base::Closure& fatal_plugin_error_cb,
386 scoped_ptr<media::SimpleCdmPromise> promise) {
386 DCHECK(!key_system.empty()); 387 DCHECK(!key_system.empty());
387 DCHECK(key_system_.empty()); 388 DCHECK(key_system_.empty());
388 key_system_ = key_system; 389 key_system_ = key_system;
389 390
390 session_message_cb_ = session_message_cb; 391 session_message_cb_ = session_message_cb;
391 session_closed_cb_ = session_closed_cb; 392 session_closed_cb_ = session_closed_cb;
392 legacy_session_error_cb_ = legacy_session_error_cb; 393 legacy_session_error_cb_ = legacy_session_error_cb;
393 session_keys_change_cb_ = session_keys_change_cb; 394 session_keys_change_cb_ = session_keys_change_cb;
394 session_expiration_update_cb_ = session_expiration_update_cb; 395 session_expiration_update_cb_ = session_expiration_update_cb;
395 fatal_plugin_error_cb_ = fatal_plugin_error_cb; 396 fatal_plugin_error_cb_ = fatal_plugin_error_cb;
396 397
398 uint32_t promise_id = cdm_promise_adapter_.SavePromise(promise.Pass());
397 plugin_decryption_interface_->Initialize( 399 plugin_decryption_interface_->Initialize(
398 pp_instance_, StringVar::StringToPPVar(key_system_), 400 pp_instance_, promise_id, StringVar::StringToPPVar(key_system_),
399 PP_FromBool(allow_distinctive_identifier), 401 PP_FromBool(allow_distinctive_identifier),
400 PP_FromBool(allow_persistent_state)); 402 PP_FromBool(allow_persistent_state));
401 } 403 }
402 404
403 void ContentDecryptorDelegate::InstanceCrashed() { 405 void ContentDecryptorDelegate::InstanceCrashed() {
404 fatal_plugin_error_cb_.Run(); 406 fatal_plugin_error_cb_.Run();
405 SatisfyAllPendingCallbacksOnError(); 407 SatisfyAllPendingCallbacksOnError();
406 } 408 }
407 409
408 void ContentDecryptorDelegate::SetServerCertificate( 410 void ContentDecryptorDelegate::SetServerCertificate(
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 empty_frames); 1290 empty_frames);
1289 } 1291 }
1290 1292
1291 if (!video_decode_cb_.is_null()) 1293 if (!video_decode_cb_.is_null())
1292 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); 1294 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL);
1293 1295
1294 cdm_promise_adapter_.Clear(); 1296 cdm_promise_adapter_.Clear();
1295 } 1297 }
1296 1298
1297 } // namespace content 1299 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698