| 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 "media/blink/webcontentdecryptionmoduleaccess_impl.h" | 5 #include "media/blink/webcontentdecryptionmoduleaccess_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" |
| 10 #include "media/blink/webencryptedmediaclient_impl.h" | 11 #include "media/blink/webencryptedmediaclient_impl.h" |
| 11 | 12 |
| 12 namespace media { | 13 namespace media { |
| 13 | 14 |
| 14 // The caller owns the created cdm (passed back using |result|). | 15 // The caller owns the created cdm (passed back using |result|). |
| 15 static void CreateCdm(const base::WeakPtr<WebEncryptedMediaClientImpl>& client, | 16 static void CreateCdm(const base::WeakPtr<WebEncryptedMediaClientImpl>& client, |
| 16 const blink::WebString& key_system, | 17 const blink::WebString& key_system, |
| 17 bool allow_distinctive_identifier, | 18 bool allow_distinctive_identifier, |
| 18 bool allow_persistent_state, | 19 bool allow_persistent_state, |
| 19 const blink::WebSecurityOrigin& security_origin, | 20 const blink::WebSecurityOrigin& security_origin, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 (configuration_.distinctiveIdentifier == | 73 (configuration_.distinctiveIdentifier == |
| 73 blink::WebMediaKeySystemConfiguration::Requirement::Required); | 74 blink::WebMediaKeySystemConfiguration::Requirement::Required); |
| 74 bool allow_persistent_state = | 75 bool allow_persistent_state = |
| 75 (configuration_.persistentState == | 76 (configuration_.persistentState == |
| 76 blink::WebMediaKeySystemConfiguration::Requirement::Required); | 77 blink::WebMediaKeySystemConfiguration::Requirement::Required); |
| 77 | 78 |
| 78 // This method needs to run asynchronously, as it may need to load the CDM. | 79 // This method needs to run asynchronously, as it may need to load the CDM. |
| 79 // As this object's lifetime is controlled by MediaKeySystemAccess on the | 80 // As this object's lifetime is controlled by MediaKeySystemAccess on the |
| 80 // blink side, copy all values needed by CreateCdm() in case the blink object | 81 // blink side, copy all values needed by CreateCdm() in case the blink object |
| 81 // gets garbage-collected. | 82 // gets garbage-collected. |
| 82 base::MessageLoopProxy::current()->PostTask( | 83 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 83 FROM_HERE, | 84 FROM_HERE, |
| 84 base::Bind(&CreateCdm, client_, key_system_, allow_distinctive_identifier, | 85 base::Bind(&CreateCdm, client_, key_system_, allow_distinctive_identifier, |
| 85 allow_persistent_state, security_origin_, result)); | 86 allow_persistent_state, security_origin_, result)); |
| 86 } | 87 } |
| 87 | 88 |
| 88 } // namespace media | 89 } // namespace media |
| OLD | NEW |