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 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.os.RemoteException; | 8 import android.os.RemoteException; |
9 import android.util.Log; | 9 import android.util.Log; |
10 import android.view.Surface; | 10 import android.view.Surface; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 final int clientContext) { | 173 final int clientContext) { |
174 assert clientContext != 0; | 174 assert clientContext != 0; |
175 SandboxedProcessConnection allocatedConnection; | 175 SandboxedProcessConnection allocatedConnection; |
176 synchronized (SandboxedProcessLauncher.class) { | 176 synchronized (SandboxedProcessLauncher.class) { |
177 allocatedConnection = mSpareConnection; | 177 allocatedConnection = mSpareConnection; |
178 mSpareConnection = null; | 178 mSpareConnection = null; |
179 } | 179 } |
180 if (allocatedConnection == null) { | 180 if (allocatedConnection == null) { |
181 allocatedConnection = allocateBoundConnection(context, commandLine); | 181 allocatedConnection = allocateBoundConnection(context, commandLine); |
182 if (allocatedConnection == null) { | 182 if (allocatedConnection == null) { |
| 183 // Notify the native code so it can free the heap allocated call
back. |
| 184 nativeOnSandboxedProcessStarted(clientContext, 0); |
183 return; | 185 return; |
184 } | 186 } |
185 } | 187 } |
186 final SandboxedProcessConnection connection = allocatedConnection; | 188 final SandboxedProcessConnection connection = allocatedConnection; |
187 Log.d(TAG, "Setting up connection to process: slot=" + connection.getSer
viceNumber()); | 189 Log.d(TAG, "Setting up connection to process: slot=" + connection.getSer
viceNumber()); |
188 // Note: This runnable will be executed when the sandboxed connection is
setup. | 190 // Note: This runnable will be executed when the sandboxed connection is
setup. |
189 final Runnable onConnect = new Runnable() { | 191 final Runnable onConnect = new Runnable() { |
190 @Override | 192 @Override |
191 public void run() { | 193 public void run() { |
192 final int pid = connection.getPid(); | 194 final int pid = connection.getPid(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // avoid waiting for the finalizer to get around to it. | 292 // avoid waiting for the finalizer to get around to it. |
291 if (surface != null) { | 293 if (surface != null) { |
292 surface.release(); | 294 surface.release(); |
293 } | 295 } |
294 } | 296 } |
295 }; | 297 }; |
296 }; | 298 }; |
297 | 299 |
298 private static native void nativeOnSandboxedProcessStarted(int clientContext
, int pid); | 300 private static native void nativeOnSandboxedProcessStarted(int clientContext
, int pid); |
299 } | 301 } |
OLD | NEW |