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

Side by Side Diff: media/blink/webcontentdecryptionmoduleaccess_impl.cc

Issue 1904253002: Convert //media/blink from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 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 "media/blink/webcontentdecryptionmoduleaccess_impl.h" 5 #include "media/blink/webcontentdecryptionmoduleaccess_impl.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/location.h" 11 #include "base/location.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "media/blink/webencryptedmediaclient_impl.h" 14 #include "media/blink/webencryptedmediaclient_impl.h"
15 15
16 namespace media { 16 namespace media {
17 17
18 // The caller owns the created cdm (passed back using |result|). 18 // The caller owns the created cdm (passed back using |result|).
19 static void CreateCdm( 19 static void CreateCdm(
20 const base::WeakPtr<WebEncryptedMediaClientImpl>& client, 20 const base::WeakPtr<WebEncryptedMediaClientImpl>& client,
21 const blink::WebString& key_system, 21 const blink::WebString& key_system,
22 const blink::WebSecurityOrigin& security_origin, 22 const blink::WebSecurityOrigin& security_origin,
23 const CdmConfig& cdm_config, 23 const CdmConfig& cdm_config,
24 scoped_ptr<blink::WebContentDecryptionModuleResult> result) { 24 std::unique_ptr<blink::WebContentDecryptionModuleResult> result) {
25 // If |client| is gone (due to the frame getting destroyed), it is 25 // If |client| is gone (due to the frame getting destroyed), it is
26 // impossible to create the CDM, so fail. 26 // impossible to create the CDM, so fail.
27 if (!client) { 27 if (!client) {
28 result->completeWithError( 28 result->completeWithError(
29 blink::WebContentDecryptionModuleExceptionInvalidStateError, 0, 29 blink::WebContentDecryptionModuleExceptionInvalidStateError, 0,
30 "Failed to create CDM."); 30 "Failed to create CDM.");
31 return; 31 return;
32 } 32 }
33 33
34 client->CreateCdm(key_system, security_origin, cdm_config, std::move(result)); 34 client->CreateCdm(key_system, security_origin, cdm_config, std::move(result));
(...skipping 30 matching lines...) Expand all
65 WebContentDecryptionModuleAccessImpl::getConfiguration() { 65 WebContentDecryptionModuleAccessImpl::getConfiguration() {
66 return configuration_; 66 return configuration_;
67 } 67 }
68 68
69 void WebContentDecryptionModuleAccessImpl::createContentDecryptionModule( 69 void WebContentDecryptionModuleAccessImpl::createContentDecryptionModule(
70 blink::WebContentDecryptionModuleResult result) { 70 blink::WebContentDecryptionModuleResult result) {
71 // This method needs to run asynchronously, as it may need to load the CDM. 71 // This method needs to run asynchronously, as it may need to load the CDM.
72 // As this object's lifetime is controlled by MediaKeySystemAccess on the 72 // As this object's lifetime is controlled by MediaKeySystemAccess on the
73 // blink side, copy all values needed by CreateCdm() in case the blink object 73 // blink side, copy all values needed by CreateCdm() in case the blink object
74 // gets garbage-collected. 74 // gets garbage-collected.
75 scoped_ptr<blink::WebContentDecryptionModuleResult> result_copy( 75 std::unique_ptr<blink::WebContentDecryptionModuleResult> result_copy(
76 new blink::WebContentDecryptionModuleResult(result)); 76 new blink::WebContentDecryptionModuleResult(result));
77 base::ThreadTaskRunnerHandle::Get()->PostTask( 77 base::ThreadTaskRunnerHandle::Get()->PostTask(
78 FROM_HERE, base::Bind(&CreateCdm, client_, key_system_, security_origin_, 78 FROM_HERE, base::Bind(&CreateCdm, client_, key_system_, security_origin_,
79 cdm_config_, base::Passed(&result_copy))); 79 cdm_config_, base::Passed(&result_copy)));
80 } 80 }
81 81
82 } // namespace media 82 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webcontentdecryptionmodule_impl.cc ('k') | media/blink/webcontentdecryptionmodulesession_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698