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

Side by Side Diff: content/renderer/media/crypto/ppapi_decryptor.cc

Issue 1128693004: Don't initialize decryptor on CDM creation failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/crypto/ppapi_decryptor.h" 5 #include "content/renderer/media/crypto/ppapi_decryptor.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 26 matching lines...) Expand all
37 const media::CdmCreatedCB& cdm_created_cb) { 37 const media::CdmCreatedCB& cdm_created_cb) {
38 std::string plugin_type = media::GetPepperType(key_system); 38 std::string plugin_type = media::GetPepperType(key_system);
39 DCHECK(!plugin_type.empty()); 39 DCHECK(!plugin_type.empty());
40 scoped_ptr<PepperCdmWrapper> pepper_cdm_wrapper = 40 scoped_ptr<PepperCdmWrapper> pepper_cdm_wrapper =
41 create_pepper_cdm_cb.Run(plugin_type, security_origin); 41 create_pepper_cdm_cb.Run(plugin_type, security_origin);
42 if (!pepper_cdm_wrapper) { 42 if (!pepper_cdm_wrapper) {
43 DLOG(ERROR) << "Plugin instance creation failed."; 43 DLOG(ERROR) << "Plugin instance creation failed.";
44 base::MessageLoopProxy::current()->PostTask( 44 base::MessageLoopProxy::current()->PostTask(
45 FROM_HERE, base::Bind(cdm_created_cb, nullptr, 45 FROM_HERE, base::Bind(cdm_created_cb, nullptr,
46 "Plugin instance creation failed.")); 46 "Plugin instance creation failed."));
47 return;
47 } 48 }
48 49
49 scoped_ptr<PpapiDecryptor> ppapi_decryptor( 50 scoped_ptr<PpapiDecryptor> ppapi_decryptor(
50 new PpapiDecryptor(pepper_cdm_wrapper.Pass(), session_message_cb, 51 new PpapiDecryptor(pepper_cdm_wrapper.Pass(), session_message_cb,
51 session_closed_cb, legacy_session_error_cb, 52 session_closed_cb, legacy_session_error_cb,
52 session_keys_change_cb, session_expiration_update_cb)); 53 session_keys_change_cb, session_expiration_update_cb));
53 54
54 // PpapiDecryptor ownership passed to the promise, but keep a copy in order 55 // PpapiDecryptor ownership passed to the promise, but keep a copy in order
55 // to call InitializeCdm(). 56 // to call InitializeCdm().
56 PpapiDecryptor* ppapi_decryptor_copy = ppapi_decryptor.get(); 57 PpapiDecryptor* ppapi_decryptor_copy = ppapi_decryptor.get();
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); 458 DCHECK(render_loop_proxy_->BelongsToCurrentThread());
458 pepper_cdm_wrapper_.reset(); 459 pepper_cdm_wrapper_.reset();
459 } 460 }
460 461
461 ContentDecryptorDelegate* PpapiDecryptor::CdmDelegate() { 462 ContentDecryptorDelegate* PpapiDecryptor::CdmDelegate() {
462 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); 463 DCHECK(render_loop_proxy_->BelongsToCurrentThread());
463 return (pepper_cdm_wrapper_) ? pepper_cdm_wrapper_->GetCdmDelegate() : NULL; 464 return (pepper_cdm_wrapper_) ? pepper_cdm_wrapper_->GetCdmDelegate() : NULL;
464 } 465 }
465 466
466 } // namespace content 467 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698