OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/android/content_video_view.h" | 5 #include "content/browser/android/content_video_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 namespace { | 27 namespace { |
28 // There can only be one content video view at a time, this holds onto that | 28 // There can only be one content video view at a time, this holds onto that |
29 // singleton instance. | 29 // singleton instance. |
30 ContentVideoView* g_content_video_view = NULL; | 30 ContentVideoView* g_content_video_view = NULL; |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 static ScopedJavaLocalRef<jobject> GetSingletonJavaContentVideoView(JNIEnv* env, | 34 static jobject GetSingletonJavaContentVideoView(JNIEnv*env, jclass) { |
35 jclass) { | |
36 if (g_content_video_view) | 35 if (g_content_video_view) |
37 return g_content_video_view->GetJavaObject(env); | 36 return g_content_video_view->GetJavaObject(env).Release(); |
38 else | 37 else |
39 return ScopedJavaLocalRef<jobject>(); | 38 return NULL; |
40 } | 39 } |
41 | 40 |
42 bool ContentVideoView::RegisterContentVideoView(JNIEnv* env) { | 41 bool ContentVideoView::RegisterContentVideoView(JNIEnv* env) { |
43 return RegisterNativesImpl(env); | 42 return RegisterNativesImpl(env); |
44 } | 43 } |
45 | 44 |
46 ContentVideoView* ContentVideoView::GetInstance() { | 45 ContentVideoView* ContentVideoView::GetInstance() { |
47 return g_content_video_view; | 46 return g_content_video_view; |
48 } | 47 } |
49 | 48 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 return JavaObjectWeakGlobalRef(env, nullptr); | 205 return JavaObjectWeakGlobalRef(env, nullptr); |
207 | 206 |
208 return JavaObjectWeakGlobalRef( | 207 return JavaObjectWeakGlobalRef( |
209 env, | 208 env, |
210 Java_ContentVideoView_createContentVideoView( | 209 Java_ContentVideoView_createContentVideoView( |
211 env, | 210 env, |
212 j_content_view_core.obj(), | 211 j_content_view_core.obj(), |
213 reinterpret_cast<intptr_t>(this)).obj()); | 212 reinterpret_cast<intptr_t>(this)).obj()); |
214 } | 213 } |
215 } // namespace content | 214 } // namespace content |
OLD | NEW |