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

Side by Side Diff: media/base/android/media_drm_bridge.cc

Issue 1116683002: [media] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased patch 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 | « media/base/android/media_decoder_job.cc ('k') | media/base/android/media_player_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/base/android/media_drm_bridge.h" 5 #include "media/base/android/media_drm_bridge.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/callback_helpers.h" 12 #include "base/callback_helpers.h"
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/message_loop/message_loop_proxy.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/stl_util.h" 18 #include "base/stl_util.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/sys_byteorder.h" 20 #include "base/sys_byteorder.h"
21 #include "base/sys_info.h" 21 #include "base/sys_info.h"
22 #include "base/thread_task_runner_handle.h"
22 #include "jni/MediaDrmBridge_jni.h" 23 #include "jni/MediaDrmBridge_jni.h"
23 #include "media/base/android/media_client_android.h" 24 #include "media/base/android/media_client_android.h"
24 #include "media/base/android/media_drm_bridge_delegate.h" 25 #include "media/base/android/media_drm_bridge_delegate.h"
25 #include "media/base/cdm_key_information.h" 26 #include "media/base/cdm_key_information.h"
26 27
27 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 28 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
28 29
29 using base::android::AttachCurrentThread; 30 using base::android::AttachCurrentThread;
30 using base::android::ConvertUTF8ToJavaString; 31 using base::android::ConvertUTF8ToJavaString;
31 using base::android::ConvertJavaStringToUTF8; 32 using base::android::ConvertJavaStringToUTF8;
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 408
408 void MediaDrmBridge::SetMediaCryptoReadyCB(const base::Closure& closure) { 409 void MediaDrmBridge::SetMediaCryptoReadyCB(const base::Closure& closure) {
409 if (closure.is_null()) { 410 if (closure.is_null()) {
410 media_crypto_ready_cb_.Reset(); 411 media_crypto_ready_cb_.Reset();
411 return; 412 return;
412 } 413 }
413 414
414 DCHECK(media_crypto_ready_cb_.is_null()); 415 DCHECK(media_crypto_ready_cb_.is_null());
415 416
416 if (!GetMediaCrypto().is_null()) { 417 if (!GetMediaCrypto().is_null()) {
417 base::MessageLoopProxy::current()->PostTask(FROM_HERE, closure); 418 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, closure);
418 return; 419 return;
419 } 420 }
420 421
421 media_crypto_ready_cb_ = closure; 422 media_crypto_ready_cb_ = closure;
422 } 423 }
423 424
424 void MediaDrmBridge::OnMediaCryptoReady(JNIEnv* env, jobject) { 425 void MediaDrmBridge::OnMediaCryptoReady(JNIEnv* env, jobject) {
425 DCHECK(!GetMediaCrypto().is_null()); 426 DCHECK(!GetMediaCrypto().is_null());
426 if (!media_crypto_ready_cb_.is_null()) 427 if (!media_crypto_ready_cb_.is_null())
427 base::ResetAndReturn(&media_crypto_ready_cb_).Run(); 428 base::ResetAndReturn(&media_crypto_ready_cb_).Run();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 JNIEnv* env = AttachCurrentThread(); 534 JNIEnv* env = AttachCurrentThread();
534 Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj()); 535 Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj());
535 } 536 }
536 537
537 void MediaDrmBridge::OnResetDeviceCredentialsCompleted( 538 void MediaDrmBridge::OnResetDeviceCredentialsCompleted(
538 JNIEnv* env, jobject, bool success) { 539 JNIEnv* env, jobject, bool success) {
539 base::ResetAndReturn(&reset_credentials_cb_).Run(success); 540 base::ResetAndReturn(&reset_credentials_cb_).Run(success);
540 } 541 }
541 542
542 } // namespace media 543 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_decoder_job.cc ('k') | media/base/android/media_player_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698