| 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/app/android/child_process_service.h" | 5 #include "content/app/android/child_process_service.h" |
| 6 | 6 |
| 7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
| 8 #include <cpu-features.h> | 8 #include <cpu-features.h> |
| 9 | 9 |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 surface_texture_id, | 61 surface_texture_id, |
| 62 client_id, | 62 client_id, |
| 63 surface_texture->j_surface_texture().obj()); | 63 surface_texture->j_surface_texture().obj()); |
| 64 } | 64 } |
| 65 virtual void UnregisterSurfaceTexture(int surface_texture_id, | 65 virtual void UnregisterSurfaceTexture(int surface_texture_id, |
| 66 int client_id) override { | 66 int client_id) override { |
| 67 JNIEnv* env = base::android::AttachCurrentThread(); | 67 JNIEnv* env = base::android::AttachCurrentThread(); |
| 68 Java_ChildProcessService_destroySurfaceTextureSurface( | 68 Java_ChildProcessService_destroySurfaceTextureSurface( |
| 69 env, service_.obj(), surface_texture_id, client_id); | 69 env, service_.obj(), surface_texture_id, client_id); |
| 70 } | 70 } |
| 71 virtual gfx::AcceleratedWidget AcquireNativeWidget(int surface_texture_id, | 71 virtual gfx::AcceleratedWidget AcquireNativeWidgetForSurfaceTexture( |
| 72 int client_id) override { | 72 int surface_texture_id) override { |
| 73 JNIEnv* env = base::android::AttachCurrentThread(); | 73 JNIEnv* env = base::android::AttachCurrentThread(); |
| 74 gfx::ScopedJavaSurface surface( | 74 gfx::ScopedJavaSurface surface( |
| 75 Java_ChildProcessService_getSurfaceTextureSurface( | 75 Java_ChildProcessService_getSurfaceTextureSurface(env, service_.obj(), |
| 76 env, service_.obj(), surface_texture_id, client_id)); | 76 surface_texture_id)); |
| 77 | 77 |
| 78 if (surface.j_surface().is_null()) | 78 if (surface.j_surface().is_null()) |
| 79 return NULL; | 79 return NULL; |
| 80 | 80 |
| 81 // Note: This ensures that any local references used by | 81 // Note: This ensures that any local references used by |
| 82 // ANativeWindow_fromSurface are released immediately. This is needed as a | 82 // ANativeWindow_fromSurface are released immediately. This is needed as a |
| 83 // workaround for https://code.google.com/p/android/issues/detail?id=68174 | 83 // workaround for https://code.google.com/p/android/issues/detail?id=68174 |
| 84 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); | 84 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); |
| 85 ANativeWindow* native_window = | 85 ANativeWindow* native_window = |
| 86 ANativeWindow_fromSurface(env, surface.j_surface().obj()); | 86 ANativeWindow_fromSurface(env, surface.j_surface().obj()); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 185 |
| 186 bool RegisterChildProcessService(JNIEnv* env) { | 186 bool RegisterChildProcessService(JNIEnv* env) { |
| 187 return RegisterNativesImpl(env); | 187 return RegisterNativesImpl(env); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void ShutdownMainThread(JNIEnv* env, jobject obj) { | 190 void ShutdownMainThread(JNIEnv* env, jobject obj) { |
| 191 ChildThread::ShutdownThread(); | 191 ChildThread::ShutdownThread(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace content | 194 } // namespace content |
| OLD | NEW |