OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.content.pm.ApplicationInfo; | 8 import android.content.pm.ApplicationInfo; |
9 import android.content.pm.PackageManager; | 9 import android.content.pm.PackageManager; |
10 import android.graphics.SurfaceTexture; | 10 import android.graphics.SurfaceTexture; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 allocateConnection(context, inSandbox, chromiumLinkerParams, alw aysInForeground); | 298 allocateConnection(context, inSandbox, chromiumLinkerParams, alw aysInForeground); |
299 if (connection != null) { | 299 if (connection != null) { |
300 connection.start(commandLine); | 300 connection.start(commandLine); |
301 } | 301 } |
302 return connection; | 302 return connection; |
303 } | 303 } |
304 | 304 |
305 private static final long FREE_CONNECTION_DELAY_MILLIS = 1; | 305 private static final long FREE_CONNECTION_DELAY_MILLIS = 1; |
306 | 306 |
307 private static void freeConnection(ChildProcessConnection connection) { | 307 private static void freeConnection(ChildProcessConnection connection) { |
308 if (connection == sSpareSandboxedConnection) sSpareSandboxedConnection = null; | |
Yaron
2015/07/16 20:50:34
.equals
Jaekyun Seok (inactive)
2015/07/16 22:10:20
Done.
| |
309 | |
308 // Freeing a service should be delayed. This is so that we avoid immedia tely reusing the | 310 // Freeing a service should be delayed. This is so that we avoid immedia tely reusing the |
309 // freed service (see http://crbug.com/164069): the framework might keep a service process | 311 // freed service (see http://crbug.com/164069): the framework might keep a service process |
310 // alive when it's been unbound for a short time. If a new connection to the same service | 312 // alive when it's been unbound for a short time. If a new connection to the same service |
311 // is bound at that point, the process is reused and bad things happen ( mostly static | 313 // is bound at that point, the process is reused and bad things happen ( mostly static |
312 // variables are set when we don't expect them to). | 314 // variables are set when we don't expect them to). |
313 final ChildProcessConnection conn = connection; | 315 final ChildProcessConnection conn = connection; |
314 ThreadUtils.postOnUiThreadDelayed(new Runnable() { | 316 ThreadUtils.postOnUiThreadDelayed(new Runnable() { |
315 @Override | 317 @Override |
316 public void run() { | 318 public void run() { |
317 getConnectionAllocator(conn.isInSandbox()).free(conn); | 319 getConnectionAllocator(conn.isInSandbox()).free(conn); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
775 } | 777 } |
776 | 778 |
777 return true; | 779 return true; |
778 } | 780 } |
779 | 781 |
780 private static native void nativeOnChildProcessStarted(long clientContext, i nt pid); | 782 private static native void nativeOnChildProcessStarted(long clientContext, i nt pid); |
781 private static native void nativeEstablishSurfacePeer( | 783 private static native void nativeEstablishSurfacePeer( |
782 int pid, Surface surface, int primaryID, int secondaryID); | 784 int pid, Surface surface, int primaryID, int secondaryID); |
783 private static native boolean nativeIsSingleProcess(); | 785 private static native boolean nativeIsSingleProcess(); |
784 } | 786 } |
OLD | NEW |