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

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

Issue 195583003: Add initial GpuMemoryBufferSurfaceTexture implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 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 | Annotate | Revision Log
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/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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 jint handle) { 74 jint handle) {
75 StartChildProcessCallback* callback = 75 StartChildProcessCallback* callback =
76 reinterpret_cast<StartChildProcessCallback*>(client_context); 76 reinterpret_cast<StartChildProcessCallback*>(client_context);
77 if (handle) 77 if (handle)
78 callback->Run(static_cast<base::ProcessHandle>(handle)); 78 callback->Run(static_cast<base::ProcessHandle>(handle));
79 delete callback; 79 delete callback;
80 } 80 }
81 81
82 void StartChildProcess( 82 void StartChildProcess(
83 const CommandLine::StringVector& argv, 83 const CommandLine::StringVector& argv,
84 int child_process_id,
84 const std::vector<content::FileDescriptorInfo>& files_to_register, 85 const std::vector<content::FileDescriptorInfo>& files_to_register,
85 const StartChildProcessCallback& callback) { 86 const StartChildProcessCallback& callback) {
86 JNIEnv* env = AttachCurrentThread(); 87 JNIEnv* env = AttachCurrentThread();
87 DCHECK(env); 88 DCHECK(env);
88 89
89 // Create the Command line String[] 90 // Create the Command line String[]
90 ScopedJavaLocalRef<jobjectArray> j_argv = ToJavaArrayOfStrings(env, argv); 91 ScopedJavaLocalRef<jobjectArray> j_argv = ToJavaArrayOfStrings(env, argv);
91 92
92 size_t file_count = files_to_register.size(); 93 size_t file_count = files_to_register.size();
93 DCHECK(file_count > 0); 94 DCHECK(file_count > 0);
(...skipping 18 matching lines...) Expand all
112 file_fds[i] = fd_info.fd.fd; 113 file_fds[i] = fd_info.fd.fd;
113 file_auto_close[i] = fd_info.fd.auto_close; 114 file_auto_close[i] = fd_info.fd.auto_close;
114 } 115 }
115 env->ReleaseIntArrayElements(j_file_ids.obj(), file_ids, 0); 116 env->ReleaseIntArrayElements(j_file_ids.obj(), file_ids, 0);
116 env->ReleaseIntArrayElements(j_file_fds.obj(), file_fds, 0); 117 env->ReleaseIntArrayElements(j_file_fds.obj(), file_fds, 0);
117 env->ReleaseBooleanArrayElements(j_file_auto_close.obj(), file_auto_close, 0); 118 env->ReleaseBooleanArrayElements(j_file_auto_close.obj(), file_auto_close, 0);
118 119
119 Java_ChildProcessLauncher_start(env, 120 Java_ChildProcessLauncher_start(env,
120 base::android::GetApplicationContext(), 121 base::android::GetApplicationContext(),
121 j_argv.obj(), 122 j_argv.obj(),
123 child_process_id,
122 j_file_ids.obj(), 124 j_file_ids.obj(),
123 j_file_fds.obj(), 125 j_file_fds.obj(),
124 j_file_auto_close.obj(), 126 j_file_auto_close.obj(),
125 reinterpret_cast<intptr_t>(new StartChildProcessCallback(callback))); 127 reinterpret_cast<intptr_t>(new StartChildProcessCallback(callback)));
126 } 128 }
127 129
128 void StopChildProcess(base::ProcessHandle handle) { 130 void StopChildProcess(base::ProcessHandle handle) {
129 JNIEnv* env = AttachCurrentThread(); 131 JNIEnv* env = AttachCurrentThread();
130 DCHECK(env); 132 DCHECK(env);
131 Java_ChildProcessLauncher_stop(env, static_cast<jint>(handle)); 133 Java_ChildProcessLauncher_stop(env, static_cast<jint>(handle));
(...skipping 17 matching lines...) Expand all
149 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); 151 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
150 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( 152 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
151 &SetSurfacePeer, jsurface, pid, primary_id, secondary_id)); 153 &SetSurfacePeer, jsurface, pid, primary_id, secondary_id));
152 } 154 }
153 155
154 jobject GetViewSurface(JNIEnv* env, jclass clazz, jint surface_id) { 156 jobject GetViewSurface(JNIEnv* env, jclass clazz, jint surface_id) {
155 // This is a synchronous call from the GPU process and is expected to be 157 // 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 158 // handled on a binder thread. Handling this on the UI thread will lead
157 // to deadlocks. 159 // to deadlocks.
158 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); 160 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
159 return CompositorImpl::GetSurface(surface_id); 161 return CompositorImpl::GetSurface(surface_id).Release();
162 }
163
164 jobject GetSurfaceTextureSurface(JNIEnv* env,
165 jclass clazz,
166 jint surface_texture_id,
167 jint child_process_id) {
168 // This is a synchronous call from a renderer process and is expected to be
169 // handled on a binder thread. Handling this on the UI thread will lead
170 // to deadlocks.
171 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
172 return CompositorImpl::GetSurfaceTextureSurface(surface_texture_id,
173 child_process_id).Release();
160 } 174 }
161 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
OLDNEW
« no previous file with comments | « content/browser/android/child_process_launcher_android.h ('k') | content/browser/child_process_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698