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

Side by Side Diff: ui/gl/android/scoped_java_surface.cc

Issue 1998723002: Move code in ui/gl/* from gfx:: to gl:: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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 | « ui/gl/android/scoped_java_surface.h ('k') | ui/gl/android/surface_texture.h » ('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 "ui/gl/android/scoped_java_surface.h" 5 #include "ui/gl/android/scoped_java_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "jni/Surface_jni.h" 8 #include "jni/Surface_jni.h"
9 #include "ui/gl/android/surface_texture.h" 9 #include "ui/gl/android/surface_texture.h"
10 10
11 namespace { 11 namespace {
12 12
13 bool g_jni_initialized = false; 13 bool g_jni_initialized = false;
14 14
15 void RegisterNativesIfNeeded(JNIEnv* env) { 15 void RegisterNativesIfNeeded(JNIEnv* env) {
16 if (!g_jni_initialized) { 16 if (!g_jni_initialized) {
17 JNI_Surface::RegisterNativesImpl(env); 17 JNI_Surface::RegisterNativesImpl(env);
18 g_jni_initialized = true; 18 g_jni_initialized = true;
19 } 19 }
20 } 20 }
21 21
22 } // anonymous namespace 22 } // anonymous namespace
23 23
24 namespace gfx { 24 namespace gl {
25 25
26 ScopedJavaSurface::ScopedJavaSurface() { 26 ScopedJavaSurface::ScopedJavaSurface() {
27 } 27 }
28 28
29 ScopedJavaSurface::ScopedJavaSurface( 29 ScopedJavaSurface::ScopedJavaSurface(
30 const base::android::JavaRef<jobject>& surface) 30 const base::android::JavaRef<jobject>& surface)
31 : auto_release_(true), 31 : auto_release_(true),
32 is_protected_(false) { 32 is_protected_(false) {
33 JNIEnv* env = base::android::AttachCurrentThread(); 33 JNIEnv* env = base::android::AttachCurrentThread();
34 RegisterNativesIfNeeded(env); 34 RegisterNativesIfNeeded(env);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 bool ScopedJavaSurface::IsEmpty() const { 74 bool ScopedJavaSurface::IsEmpty() const {
75 return j_surface_.is_null(); 75 return j_surface_.is_null();
76 } 76 }
77 77
78 // static 78 // static
79 ScopedJavaSurface ScopedJavaSurface::AcquireExternalSurface(jobject surface) { 79 ScopedJavaSurface ScopedJavaSurface::AcquireExternalSurface(jobject surface) {
80 JNIEnv* env = base::android::AttachCurrentThread(); 80 JNIEnv* env = base::android::AttachCurrentThread();
81 ScopedJavaLocalRef<jobject> surface_ref; 81 ScopedJavaLocalRef<jobject> surface_ref;
82 surface_ref.Reset(env, surface); 82 surface_ref.Reset(env, surface);
83 gfx::ScopedJavaSurface scoped_surface(surface_ref); 83 gl::ScopedJavaSurface scoped_surface(surface_ref);
84 scoped_surface.auto_release_ = false; 84 scoped_surface.auto_release_ = false;
85 scoped_surface.is_protected_ = true; 85 scoped_surface.is_protected_ = true;
86 return scoped_surface; 86 return scoped_surface;
87 } 87 }
88 88
89 } // namespace gfx 89 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/android/scoped_java_surface.h ('k') | ui/gl/android/surface_texture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698