# Default settings for chromium. This file is sourced by /bin/sh from
# /usr/bin/chromium

# Options to pass to chromium
# Default:
export CHROMIUM_FLAGS="--use-gl=angle --use-angle=gl --enable-accelerated-video-decode --enable-features=AcceleratedVideoEncoder,AcceleratedVideoDecodeLinuxGL,AcceleratedVideoDecodeLinuxZeroCopyGL"

# Do not hide any extensions in the about:extensions dialog
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --show-component-extension-options"

# Enable GPU rasterization.
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --enable-gpu-rasterization"

# Don't display any warnings about not being the default browser
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --no-default-browser-check"

# Disable pinging
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --disable-pings"

# Disable the builtin media router (bug #833477)
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --media-router=0"

# Chromium normally creates shared memory regions in /dev/shm/ (tmpfs).
# If that location is low on available space, the browser will crash due
# to insufficient shared memory (even when main memory is plentiful) in
# functions like gpu::ClientSharedImageInterface::CreateSharedImage().
# For more details, see https://bugs.debian.org/1072299#78
shm_avail=$(findmnt -bnr -o avail -T /dev/shm)

if [ $shm_avail -lt 4080218931 ]  # 3.8 GB
then
       # Use $TMPDIR or /tmp instead
       export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --disable-dev-shm-usage"
fi

# Maximum number of open file descriptors (set to 1536 for many tabs)
export CHROMIUM_ULIMIT="-n 1536"
