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

Unified Diff: media/base/android/media_player_android.cc

Issue 2231923002: Make GetApplicationContext return a JavaRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also fix not-currently-compiled unit test Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/media_player_android.cc
diff --git a/media/base/android/media_player_android.cc b/media/base/android/media_player_android.cc
index 7e202ad31fb6d202b174a43c28f0d606c7a061d4..16ea8673bae7e2baedfeacc4b3899ce873e978bb 100644
--- a/media/base/android/media_player_android.cc
+++ b/media/base/android/media_player_android.cc
@@ -7,12 +7,15 @@
#include <algorithm>
#include "base/android/context_utils.h"
+#include "base/android/scoped_java_ref.h"
#include "base/logging.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "media/base/android/media_drm_bridge.h"
#include "media/base/android/media_player_manager.h"
+using base::android::JavaRef;
+
namespace {
const double kDefaultVolume = 1.0;
@@ -106,11 +109,10 @@ void MediaPlayerAndroid::OnSeekComplete() {
void MediaPlayerAndroid::OnMediaPrepared() {}
-void MediaPlayerAndroid::AttachListener(jobject j_media_player) {
- jobject j_context = base::android::GetApplicationContext();
- DCHECK(j_context);
-
- listener_->CreateMediaPlayerListener(j_context, j_media_player);
+void MediaPlayerAndroid::AttachListener(
+ const JavaRef<jobject>& j_media_player) {
+ listener_->CreateMediaPlayerListener(base::android::GetApplicationContext(),
+ j_media_player);
}
void MediaPlayerAndroid::DetachListener() {

Powered by Google App Engine
This is Rietveld 408576698