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

Unified Diff: content/app/android/sandboxed_process_service.cc

Issue 10949027: Close leaking FDs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed last comments and synced. Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/app/android/sandboxed_process_service.cc
diff --git a/content/app/android/sandboxed_process_service.cc b/content/app/android/sandboxed_process_service.cc
index 291748ff9c09665241975a775f0b897e50309d5b..eb3c299b77895593d3495c71d4dd483f42123a2f 100644
--- a/content/app/android/sandboxed_process_service.cc
+++ b/content/app/android/sandboxed_process_service.cc
@@ -50,22 +50,18 @@ class SurfaceTexturePeerSandboxedImpl : public content::SurfaceTexturePeer {
// Chrome actually uses the renderer code path for all of its sandboxed
// processes such as renderers, plugins, etc.
-void InternalInitSandboxedProcess(int ipc_fd,
- const std::vector<int>& extra_file_ids,
- const std::vector<int>& extra_file_fds,
+void InternalInitSandboxedProcess(const std::vector<int>& file_ids,
+ const std::vector<int>& file_fds,
JNIEnv* env,
jclass clazz,
jobject context,
jobject service) {
- // Set up the IPC file descriptor mapping.
- base::GlobalDescriptors::GetInstance()->Set(kPrimaryIPCChannel, ipc_fd);
- // Register the extra file descriptors.
- // This usually include the crash dump signals and resource related files.
- DCHECK(extra_file_fds.size() == extra_file_ids.size());
- for (size_t i = 0; i < extra_file_ids.size(); ++i) {
- base::GlobalDescriptors::GetInstance()->Set(extra_file_ids[i],
- extra_file_fds[i]);
- }
+ // Register the file descriptors.
+ // This includes the IPC channel, the crash dump signals and resource related
+ // files.
+ DCHECK(file_fds.size() == file_ids.size());
+ for (size_t i = 0; i < file_ids.size(); ++i)
+ base::GlobalDescriptors::GetInstance()->Set(file_ids[i], file_fds[i]);
content::SurfaceTexturePeer::InitInstance(
new SurfaceTexturePeerSandboxedImpl(service));
@@ -80,17 +76,15 @@ void InitSandboxedProcess(JNIEnv* env,
jclass clazz,
jobject context,
jobject service,
- jint ipc_fd,
- jintArray j_extra_file_ids,
- jintArray j_extra_file_fds) {
- std::vector<int> extra_file_ids;
- std::vector<int> extra_file_fds;
- JavaIntArrayToIntVector(env, j_extra_file_ids, &extra_file_ids);
- JavaIntArrayToIntVector(env, j_extra_file_fds, &extra_file_fds);
-
- InternalInitSandboxedProcess(static_cast<int>(ipc_fd),
- extra_file_ids, extra_file_fds,
- env, clazz, context, service);
+ jintArray j_file_ids,
+ jintArray j_file_fds) {
+ std::vector<int> file_ids;
+ std::vector<int> file_fds;
+ JavaIntArrayToIntVector(env, j_file_ids, &file_ids);
+ JavaIntArrayToIntVector(env, j_file_fds, &file_fds);
+
+ InternalInitSandboxedProcess(
+ file_ids, file_fds, env, clazz, context, service);
}
void ExitSandboxedProcess(JNIEnv* env, jclass clazz) {
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | content/browser/android/sandboxed_process_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698