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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 } | 422 } |
423 | 423 |
424 /** | 424 /** |
425 * Called when the renderer commits a navigation. This signals a time at whi ch it is safe to | 425 * Called when the renderer commits a navigation. This signals a time at whi ch it is safe to |
426 * rely on renderer visibility signalled through setInForeground. See http:/ /crbug.com/421041. | 426 * rely on renderer visibility signalled through setInForeground. See http:/ /crbug.com/421041. |
427 */ | 427 */ |
428 public static void determinedVisibility(int pid) { | 428 public static void determinedVisibility(int pid) { |
429 sBindingManager.determinedVisibility(pid); | 429 sBindingManager.determinedVisibility(pid); |
430 } | 430 } |
431 | 431 |
432 private static boolean sApplicationInForeground = true; | |
Ted C
2015/03/09 22:35:03
move this up with the other variables (i.e. right
no sievers
2015/03/09 22:38:37
Done.
| |
433 | |
432 /** | 434 /** |
433 * Called when the embedding application is sent to background. | 435 * Called when the embedding application is sent to background. |
434 */ | 436 */ |
435 public static void onSentToBackground() { | 437 public static void onSentToBackground() { |
438 sApplicationInForeground = false; | |
436 sBindingManager.onSentToBackground(); | 439 sBindingManager.onSentToBackground(); |
437 } | 440 } |
438 | 441 |
439 /** | 442 /** |
440 * Called when the embedding application is brought to foreground. | 443 * Called when the embedding application is brought to foreground. |
441 */ | 444 */ |
442 public static void onBroughtToForeground() { | 445 public static void onBroughtToForeground() { |
446 sApplicationInForeground = true; | |
443 sBindingManager.onBroughtToForeground(); | 447 sBindingManager.onBroughtToForeground(); |
444 } | 448 } |
445 | 449 |
446 /** | 450 /** |
451 * Returns whether the application is currently in the foreground. | |
452 */ | |
453 static boolean isApplicationInForeground() { | |
454 return sApplicationInForeground; | |
455 } | |
456 | |
457 /** | |
447 * Should be called early in startup so the work needed to spawn the child p rocess can be done | 458 * Should be called early in startup so the work needed to spawn the child p rocess can be done |
448 * in parallel to other startup work. Must not be called on the UI thread. S pare connection is | 459 * in parallel to other startup work. Must not be called on the UI thread. S pare connection is |
449 * created in sandboxed child process. | 460 * created in sandboxed child process. |
450 * @param context the application context used for the connection. | 461 * @param context the application context used for the connection. |
451 */ | 462 */ |
452 public static void warmUp(Context context) { | 463 public static void warmUp(Context context) { |
453 synchronized (ChildProcessLauncher.class) { | 464 synchronized (ChildProcessLauncher.class) { |
454 assert !ThreadUtils.runningOnUiThread(); | 465 assert !ThreadUtils.runningOnUiThread(); |
455 if (sSpareSandboxedConnection == null) { | 466 if (sSpareSandboxedConnection == null) { |
456 sSpareSandboxedConnection = allocateBoundConnection(context, nul l, true, false); | 467 sSpareSandboxedConnection = allocateBoundConnection(context, nul l, true, false); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
748 } | 759 } |
749 | 760 |
750 return true; | 761 return true; |
751 } | 762 } |
752 | 763 |
753 private static native void nativeOnChildProcessStarted(long clientContext, i nt pid); | 764 private static native void nativeOnChildProcessStarted(long clientContext, i nt pid); |
754 private static native void nativeEstablishSurfacePeer( | 765 private static native void nativeEstablishSurfacePeer( |
755 int pid, Surface surface, int primaryID, int secondaryID); | 766 int pid, Surface surface, int primaryID, int secondaryID); |
756 private static native boolean nativeIsSingleProcess(); | 767 private static native boolean nativeIsSingleProcess(); |
757 } | 768 } |
OLD | NEW |