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/child_process_launcher_android.h" | 5 #include "content/browser/android/child_process_launcher_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 } | 152 } |
153 | 153 |
154 jobject GetViewSurface(JNIEnv* env, jclass clazz, jint surface_id) { | 154 jobject GetViewSurface(JNIEnv* env, jclass clazz, jint surface_id) { |
155 // This is a synchronous call from the GPU process and is expected to be | 155 // This is a synchronous call from the GPU process and is expected to be |
156 // handled on a binder thread. Handling this on the UI thread will lead | 156 // handled on a binder thread. Handling this on the UI thread will lead |
157 // to deadlocks. | 157 // to deadlocks. |
158 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); | 158 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); |
159 return CompositorImpl::GetSurface(surface_id); | 159 return CompositorImpl::GetSurface(surface_id); |
160 } | 160 } |
161 | 161 |
162 void SetupSurfaceTextureToRenderer( | |
163 base::ProcessHandle process, | |
164 void* gpu_memory_buffer, | |
165 scoped_refptr<gfx::SurfaceTexture> surface_texture) { | |
166 JNIEnv* env = AttachCurrentThread(); | |
167 DCHECK(env); | |
168 gfx::ScopedJavaSurface surface(surface_texture.get()); | |
Hongbo Min
2014/03/18 06:10:03
Is it safe that the Surface is released after exi
| |
169 Java_ChildProcessLauncher_setupSurfaceTextureToRenderer( | |
170 env, | |
171 static_cast<jint>(process), | |
172 reinterpret_cast<intptr_t>(gpu_memory_buffer), | |
173 surface.j_surface().obj()); | |
174 } | |
175 | |
162 jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { | 176 jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { |
163 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); | 177 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
164 } | 178 } |
165 | 179 |
166 bool RegisterChildProcessLauncher(JNIEnv* env) { | 180 bool RegisterChildProcessLauncher(JNIEnv* env) { |
167 return RegisterNativesImpl(env); | 181 return RegisterNativesImpl(env); |
168 } | 182 } |
169 | 183 |
170 } // namespace content | 184 } // namespace content |
OLD | NEW |