1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34

content / public / android / java / src / org / chromium / content_public / common / ContentProcessInfo.java [blame]

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.content_public.common;

/** Class for information about the process it is running in. */
public final class ContentProcessInfo {
    private static boolean sIsChildProcess;

    // Static members only, prevent instantiation.
    private ContentProcessInfo() {}

    /**
     * Set this as a child process; should be called as early as possible in process startup.
     * @param inChildProcess true if in child process.
     */
    public static void setInChildProcess(boolean inChildProcess) {
        sIsChildProcess = inChildProcess;
    }

    /**
     * Is this a child process?
     * <p>
     * setInChildProcess is called from the child process service, so this will not be valid until
     * that has started. In particular, it should not be called (directly or indirectly) from
     * Application.onCreate() since this is called before the service is created.
     *
     * @return true if it is a child process.
     */
    public static boolean inChildProcess() {
        return sIsChildProcess;
    }
}