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" |
11 #include "base/android/library_loader/library_loader_hooks.h" | 11 #include "base/android/library_loader/library_loader_hooks.h" |
12 #include "base/android/memory_pressure_listener_android.h" | 12 #include "base/android/memory_pressure_listener_android.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/posix/global_descriptors.h" | 14 #include "base/posix/global_descriptors.h" |
15 #include "content/child/child_thread.h" | 15 #include "content/child/child_thread.h" |
16 #include "content/common/android/surface_texture_peer.h" | 16 #include "content/common/android/surface_texture_peer.h" |
17 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" | |
17 #include "content/common/gpu/gpu_surface_lookup.h" | 18 #include "content/common/gpu/gpu_surface_lookup.h" |
18 #include "content/public/app/android_library_loader_hooks.h" | 19 #include "content/public/app/android_library_loader_hooks.h" |
19 #include "content/public/common/content_descriptors.h" | 20 #include "content/public/common/content_descriptors.h" |
20 #include "ipc/ipc_descriptors.h" | 21 #include "ipc/ipc_descriptors.h" |
21 #include "jni/ChildProcessService_jni.h" | 22 #include "jni/ChildProcessService_jni.h" |
22 #include "ui/gl/android/scoped_java_surface.h" | 23 #include "ui/gl/android/scoped_java_surface.h" |
23 | 24 |
24 using base::android::AttachCurrentThread; | 25 using base::android::AttachCurrentThread; |
25 using base::android::CheckException; | 26 using base::android::CheckException; |
26 using base::android::JavaIntArrayToIntVector; | 27 using base::android::JavaIntArrayToIntVector; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 void ExitChildProcess(JNIEnv* env, jclass clazz) { | 130 void ExitChildProcess(JNIEnv* env, jclass clazz) { |
130 VLOG(0) << "ChildProcessService: Exiting child process."; | 131 VLOG(0) << "ChildProcessService: Exiting child process."; |
131 base::android::LibraryLoaderExitHook(); | 132 base::android::LibraryLoaderExitHook(); |
132 _exit(0); | 133 _exit(0); |
133 } | 134 } |
134 | 135 |
135 bool RegisterChildProcessService(JNIEnv* env) { | 136 bool RegisterChildProcessService(JNIEnv* env) { |
136 return RegisterNativesImpl(env); | 137 return RegisterNativesImpl(env); |
137 } | 138 } |
138 | 139 |
140 void SetupSurfaceTexture(JNIEnv* env, | |
141 jclass clazz, | |
142 jlong gpu_memory_buffer, | |
143 jobject jsurface) { | |
144 ANativeWindow* window = NULL; | |
145 if (jsurface) | |
146 window = ANativeWindow_fromSurface(env, jsurface); | |
Hongbo Min
2014/03/18 06:10:03
When would `window` be released?
| |
147 GpuMemoryBufferImplSurfaceTexture* gpu_memory_buffer_handle = | |
Hongbo Min
2014/03/18 06:10:03
Return as early as possible if window is NULL.
| |
148 (GpuMemoryBufferImplSurfaceTexture*)(gpu_memory_buffer); | |
149 gpu_memory_buffer_handle->setNativeWindow(window); | |
150 } | |
151 | |
139 void ShutdownMainThread(JNIEnv* env, jobject obj) { | 152 void ShutdownMainThread(JNIEnv* env, jobject obj) { |
140 ChildThread::ShutdownThread(); | 153 ChildThread::ShutdownThread(); |
141 } | 154 } |
142 | 155 |
143 } // namespace content | 156 } // namespace content |
OLD | NEW |