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

Side by Side Diff: content/browser/android/content_video_view.cc

Issue 1288183004: jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some newlines for readability Created 5 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 unified diff | Download patch
OLDNEW
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
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 jobject GetSingletonJavaContentVideoView(JNIEnv*env, jclass) { 34 static ScopedJavaLocalRef<jobject> GetSingletonJavaContentVideoView(JNIEnv* env,
35 jclass) {
35 if (g_content_video_view) 36 if (g_content_video_view)
36 return g_content_video_view->GetJavaObject(env).Release(); 37 return g_content_video_view->GetJavaObject(env);
37 else 38 else
38 return NULL; 39 return ScopedJavaLocalRef<jobject>();
39 } 40 }
40 41
41 bool ContentVideoView::RegisterContentVideoView(JNIEnv* env) { 42 bool ContentVideoView::RegisterContentVideoView(JNIEnv* env) {
42 return RegisterNativesImpl(env); 43 return RegisterNativesImpl(env);
43 } 44 }
44 45
45 ContentVideoView* ContentVideoView::GetInstance() { 46 ContentVideoView* ContentVideoView::GetInstance() {
46 return g_content_video_view; 47 return g_content_video_view;
47 } 48 }
48 49
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return JavaObjectWeakGlobalRef(env, nullptr); 206 return JavaObjectWeakGlobalRef(env, nullptr);
206 207
207 return JavaObjectWeakGlobalRef( 208 return JavaObjectWeakGlobalRef(
208 env, 209 env,
209 Java_ContentVideoView_createContentVideoView( 210 Java_ContentVideoView_createContentVideoView(
210 env, 211 env,
211 j_content_view_core.obj(), 212 j_content_view_core.obj(),
212 reinterpret_cast<intptr_t>(this)).obj()); 213 reinterpret_cast<intptr_t>(this)).obj());
213 } 214 }
214 } // namespace content 215 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698