0

Use mojom | conditionals for mixed build conditions

Mojom now supports `|` and `&` when testing `EnableIf` and
`EnableIfNot` conditions in mojom files. Previously, to
support multiple conditions, a build.gn file would define
a specific `enabled_feature`:

```build.gn
if (is_linux || is_win) {
  enabled_features += [ "is_linux_or_win" ]
}
```

This can now be handled directly in the mojom:

```mojom
  [EnableIf=is_linux|is_win]
  struct Foo {
    ...
  };
```

This CL applies this build.gn simplification where mixed
OS conditionals have been defined, and where no corresponding
build flag exists in the .cc/.h source (i.e. the .cc file
uses `BUILDFLAG(IS_WIN)||BUILDFLAG(IS_LINUX)`).

There should be no functional changes.

Bug: 378692747
Change-Id: I2bc404b838f47fe138c0291bb955eed403b11485
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6021499
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1383260}
This commit is contained in:
Alex Gough
2024-11-14 21:55:05 +00:00
committed by Chromium LUCI CQ
parent 92f01d707d
commit 134ead4152
33 changed files with 298 additions and 352 deletions
cc/mojom
components/services
on_device_translation
storage
gpu/ipc/common
media/mojo/mojom
printing/mojom
sandbox/policy/mojom
services
device
resource_coordinator
public
mojom
tracing
viz
privileged
third_party/blink/public/mojom
ui
gfx
webui
resources
cr_components

@ -30,11 +30,6 @@ mojom("mojom") {
"touch_action.mojom",
]
enabled_features = []
if (is_android || is_ios) {
enabled_features += [ "is_android_or_ios" ]
}
public_deps = [
"//mojo/public/mojom/base",
"//services/viz/public/mojom",

@ -87,34 +87,34 @@ struct RenderFrameMetadata {
// Used to position Android/iOS bottom bar, whose position is computed by the
// renderer compositor.
[EnableIf=is_android_or_ios]
[EnableIf=is_android|is_ios]
float bottom_controls_height;
[EnableIf=is_android_or_ios]
[EnableIf=is_android|is_ios]
float bottom_controls_shown_ratio;
[EnableIf=is_android_or_ios]
[EnableIf=is_android|is_ios]
float top_controls_min_height_offset;
[EnableIf=is_android_or_ios]
[EnableIf=is_android|is_ios]
float bottom_controls_min_height_offset;
[EnableIf=is_android_or_ios]
[EnableIf=is_android|is_ios]
float min_page_scale_factor;
[EnableIf=is_android_or_ios]
[EnableIf=is_android|is_ios]
float max_page_scale_factor;
[EnableIf=is_android_or_ios]
[EnableIf=is_android|is_ios]
bool root_overflow_y_hidden;
[EnableIf=is_android_or_ios]
[EnableIf=is_android|is_ios]
gfx.mojom.SizeF scrollable_viewport_size;
[EnableIf=is_android_or_ios]
[EnableIf=is_android|is_ios]
gfx.mojom.SizeF root_layer_size;
[EnableIf=is_android_or_ios]
[EnableIf=is_android|is_ios]
bool has_transparent_background;
};
@ -168,8 +168,8 @@ interface RenderFrameMetadataObserver {
// RenderFrameMetadataObserver::UpdateRootScrollOffsetUpdateFrequency.
interface RenderFrameMetadataObserverClient {
// Notified when RenderFrameMetadata has changed.
OnRenderFrameMetadataChanged(uint32 frame_token,
RenderFrameMetadata metadata);
OnRenderFrameMetadataChanged(
uint32 frame_token, RenderFrameMetadata metadata);
// Notified on all frame submissions.
OnFrameSubmissionForTesting(uint32 frame_token);

@ -16,11 +16,4 @@ mojom("mojom") {
"//mojo/public/mojom/base",
"//sandbox/policy/mojom",
]
enabled_features = []
if (is_linux || is_mac) {
enabled_features += [ "is_linux_or_mac" ]
}
if (is_win || is_linux || is_mac) {
enabled_features += [ "is_linux_or_mac_or_win" ]
}
}

@ -77,7 +77,7 @@ enum CreateTranslatorResult {
// Currently the sandboxing of the On Device Translation service is supported
// only on macOS and Linux.
// TODO(crbug.com/340778819): Implement sandboxing on other platforms.
[EnableIf=is_linux_or_mac]
[EnableIf=is_linux|is_mac]
const sandbox.mojom.Sandbox kOnDeviceTranslationSandbox =
sandbox.mojom.Sandbox.kOnDeviceTranslation;
@ -85,7 +85,7 @@ const sandbox.mojom.Sandbox kOnDeviceTranslationSandbox =
const sandbox.mojom.Sandbox kOnDeviceTranslationSandbox =
sandbox.mojom.Sandbox.kService;
[EnableIfNot=is_linux_or_mac_or_win]
[EnableIfNot=is_linux|is_mac|is_win]
const sandbox.mojom.Sandbox kOnDeviceTranslationSandbox =
sandbox.mojom.Sandbox.kNoSandbox;

@ -45,14 +45,6 @@ mojom("mojom") {
"//third_party/blink/public/mojom:mojom_platform",
]
component_deps = [ "//third_party/blink/public/common" ]
enabled_features = []
if (is_linux || is_chromeos) {
enabled_features += [ "is_linux_or_chromeos" ]
}
if (!is_android) {
enabled_features += [ "is_not_android" ]
}
}
mojom("test_api") {

@ -8,12 +8,13 @@ import "components/services/storage/public/mojom/partition.mojom";
import "mojo/public/mojom/base/file_path.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
[EnableIf=is_not_android]
[EnableIfNot=is_android]
import "components/services/storage/public/mojom/filesystem/directory.mojom";
[EnableIf=is_linux_or_chromeos]
[EnableIf=is_chromeos|is_linux]
const sandbox.mojom.Sandbox kStorageSandbox = sandbox.mojom.Sandbox.kUtility;
[EnableIfNot=is_linux_or_chromeos]
[EnableIfNot=is_chromeos|is_linux]
const sandbox.mojom.Sandbox kStorageSandbox = sandbox.mojom.Sandbox.kService;
// The main interface into the Storage Service. The browser maintains a single
@ -35,9 +36,9 @@ interface StorageService {
//
// Once called, the service will use begin using |directory| for all
// privileged filesystem operations.
[EnableIf=is_not_android]
SetDataDirectory(mojo_base.mojom.FilePath path,
pending_remote<Directory> directory);
[EnableIfNot=is_android]
SetDataDirectory(
mojo_base.mojom.FilePath path, pending_remote<Directory> directory);
// Binds a new Partition endpoint.
//
@ -48,8 +49,8 @@ interface StorageService {
// If |path| is null, the bound partition exists only in-memory and is
// uniquely owned by a single client. Disconnecting the Partition client
// effectively destroys the partition and its contents.
BindPartition(mojo_base.mojom.FilePath? path,
pending_receiver<Partition> receiver);
BindPartition(
mojo_base.mojom.FilePath? path, pending_receiver<Partition> receiver);
// Binds a receiving endpoint for the TestApi interface defined in
// test_api.mojom. Note that this message is not strongly typed in order to

@ -363,9 +363,6 @@ mojom("interfaces") {
public_deps += [ ":vulkan_interface" ]
enabled_features += [ "supports_vulkan" ]
}
if (is_win || is_chromeos) {
enabled_features += [ "has_gpu_revision_info" ]
}
cpp_typemaps = [
{

@ -5,13 +5,14 @@
// gpu/config/gpu_info.h
module gpu.mojom;
[EnableIf=is_win]
import "gpu/ipc/common/luid.mojom";
import "mojo/public/mojom/base/time.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gl/mojom/gl_implementation.mojom";
import "ui/gl/mojom/gpu_preference.mojom";
[EnableIf=is_win]
import "gpu/ipc/common/luid.mojom";
[EnableIf=supports_vulkan]
import "gpu/ipc/common/vulkan_info.mojom";
@ -19,15 +20,18 @@ import "gpu/ipc/common/vulkan_info.mojom";
struct GpuDevice {
uint32 vendor_id;
uint32 device_id;
[EnableIf=is_win]
uint32 sub_sys_id;
[EnableIf=has_gpu_revision_info]
[EnableIf=is_chromeos|is_win]
uint32 revision;
bool active;
string vendor_string;
string device_string;
string driver_vendor;
string driver_version;
[EnableIf=is_win]
Luid luid;
gl.mojom.GpuPreference gpu_preference;
@ -187,23 +191,27 @@ struct GpuInfo {
[EnableIf=is_win]
uint32 directml_feature_level;
[EnableIf=is_win]
uint32 d3d12_feature_level;
[EnableIf=is_win]
uint32 vulkan_version;
[EnableIf=is_win]
OverlayInfo overlay_info;
[EnableIf=is_win]
bool shared_image_d3d;
array<VideoDecodeAcceleratorSupportedProfile>
video_decode_accelerator_supported_profiles;
video_decode_accelerator_supported_profiles;
array<VideoEncodeAcceleratorSupportedProfile>
video_encode_accelerator_supported_profiles;
video_encode_accelerator_supported_profiles;
bool jpeg_decode_accelerator_supported;
array<ImageDecodeAcceleratorSupportedProfile>
image_decode_accelerator_supported_profiles;
image_decode_accelerator_supported_profiles;
bool subpixel_font_rendering;
uint32 visibility_callback_call_count;

@ -109,10 +109,6 @@ mojom("mojom") {
}
enabled_features = []
if (is_linux || is_chromeos) {
enabled_features += [ "is_linux_or_chromeos" ]
}
if (allow_oop_video_decoder) {
enabled_features += [ "allow_oop_video_decoder" ]
}

@ -13,11 +13,6 @@ mojom("stable_video_decoder") {
"stable_video_decoder_types.mojom",
]
enabled_features = []
if (is_linux || is_chromeos_ash) {
enabled_features += [ "is_linux_or_chromeos_ash" ]
}
public_deps = [
":native_pixmap_handle",
"//gpu/ipc/common:interfaces",

@ -52,8 +52,8 @@ interface VideoDecoderClient {
// The client shall call VideoFrameHandleReleaser::ReleaseVideoFrame() with
// |release_token| when it is finished using |frame|.
OnVideoFrameDecoded@0(VideoFrame frame,
bool can_read_without_stalling,
mojo_base.mojom.UnguessableToken release_token);
bool can_read_without_stalling,
mojo_base.mojom.UnguessableToken release_token);
// Called when the remote decoder is waiting because of |reason|, e.g. waiting
// for decryption key.
@ -75,8 +75,8 @@ interface CdmContextEventCallback {
interface StableCdmContext {
// Proxies to media::CdmContext::GetChromeOsCdmContext()->GetHwKeyData.
[MinVersion=1]
GetHwKeyData@0(DecryptConfig decrypt_config, array<uint8> hw_identifier) =>
(DecryptStatus status, array<uint8> key_data);
GetHwKeyData@0(DecryptConfig decrypt_config, array<uint8> hw_identifier)
=> (DecryptStatus status, array<uint8> key_data);
// Registers an interface for receiving event callbacks. This maps to
// media::CdmContext::RegisterEventCB.
@ -100,15 +100,16 @@ interface StableCdmContext {
// Proxies to
// media::CdmContext::GetChromeOsCdmContext()->ParseEncryptedSliceHeader.
[MinVersion=3]
ParseEncryptedSliceHeader@5(uint64 secure_handle, uint32 offset,
array<uint8> stream_data)
ParseEncryptedSliceHeader@5(
uint64 secure_handle, uint32 offset, array<uint8> stream_data)
=> (bool success, array<uint8> slice_header);
// Proxies to
// media::CdmContext::GetDecryptor()->Decrypt for video data.
[MinVersion=4]
DecryptVideoBuffer@6(DecoderBuffer buffer, array<uint8> bytes)
=> (DecryptStatus status, DecoderBuffer? decoder_buffer,
=> (DecryptStatus status,
DecoderBuffer? decoder_buffer,
array<uint8> bytes);
};
@ -123,9 +124,9 @@ interface StableVideoDecoder {
//
// May be called before Construct().
[Sync]
GetSupportedConfigs@0() =>
(array<SupportedVideoDecoderConfig> supported_configs,
VideoDecoderType decoder_type);
GetSupportedConfigs@0()
=> (array<SupportedVideoDecoderConfig> supported_configs,
VideoDecoderType decoder_type);
// Initialize the decoder. This must be called before any method other than
// GetSupportedConfigs().
@ -155,7 +156,8 @@ interface StableVideoDecoder {
//
// TODO(b/195769334): consider passing |cdm_context| in Construct() instead of
// Initialize().
Initialize@2(VideoDecoderConfig config, bool low_delay,
Initialize@2(VideoDecoderConfig config,
bool low_delay,
pending_remote<StableCdmContext>? cdm_context)
=> (Status status,
bool needs_bitstream_conversion,
@ -176,12 +178,13 @@ interface StableVideoDecoder {
// Only Chrome-for-Linux and ash-chrome should host the implementation of a
// StableVideoDecoderFactory.
[EnableIf=is_linux_or_chromeos_ash]
const sandbox.mojom.Sandbox kStableVideoDecoderFactoryServiceSandbox
= sandbox.mojom.Sandbox.kHardwareVideoDecoding;
[EnableIfNot=is_linux_or_chromeos_ash]
const sandbox.mojom.Sandbox kStableVideoDecoderFactoryServiceSandbox
= sandbox.mojom.Sandbox.kNoSandbox;
[EnableIf=is_chromeos_ash|is_linux]
const sandbox.mojom.Sandbox kStableVideoDecoderFactoryServiceSandbox =
sandbox.mojom.Sandbox.kHardwareVideoDecoding;
[EnableIfNot=is_chromeos_ash|is_linux]
const sandbox.mojom.Sandbox kStableVideoDecoderFactoryServiceSandbox =
sandbox.mojom.Sandbox.kNoSandbox;
// A disconnection of this interface can be interpreted as the
// StableVideoDecoder implementation created by
@ -224,7 +227,7 @@ interface StableVideoDecoderFactory {
// connection to call InitializeStableVideoDecoderFactory() with the
// pending_receiver<StableVideoDecoderFactory> from (1).
[ServiceSandbox=kStableVideoDecoderFactoryServiceSandbox,
EnableIf=is_linux_or_chromeos_ash]
EnableIf=is_chromeos_ash|is_linux]
interface StableVideoDecoderFactoryProcess {
// Initializes a StableVideoDecoderFactory using |gpu_feature_info| to
// restrict the supported video decode configurations.

@ -6,13 +6,13 @@ module media.mojom;
import "media/mojo/mojom/media_log.mojom";
import "media/mojo/mojom/media_types.mojom";
import "media/mojo/mojom/video_encoder_info.mojom";
import "mojo/public/mojom/base/shared_memory.mojom";
import "mojo/public/mojom/base/time.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/mojom/color_space.mojom";
import "media/mojo/mojom/video_encoder_info.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
// This file is the Mojo version of the media::VideoEncodeAccelerator interface
// and describes the communication between a Client and a remote "service"
@ -37,13 +37,11 @@ import "sandbox/policy/mojom/sandbox.mojom";
// At any time the VEA can send a NotifyError() to the Client. Similarly at any
// time the Client can send a RequestEncodingParametersChange() to the VEA. None
// of these messages are acknowledged.
enum VideoEncodeAcceleratorSupportedRateControlMode {
kNoMode,
kConstantMode,
kVariableMode,
kExternalMode
kExternalMode,
};
struct VideoEncodeAcceleratorSupportedProfile {
@ -76,8 +74,8 @@ interface VideoEncodeAcceleratorProvider {
// VideoFrames backed by CPU memory or GpuMemoryBuffer may be supplied as
// input.
CreateVideoEncodeAccelerator(
EncodeCommandBufferId? command_buffer_id,
pending_receiver<VideoEncodeAccelerator> receiver);
EncodeCommandBufferId? command_buffer_id,
pending_receiver<VideoEncodeAccelerator> receiver);
// Get a VideoEncodeAccelerator supported profiles.
[Sync]
@ -101,13 +99,13 @@ interface VideoEncodeAcceleratorProvider {
// 3) The browser process calls CreateVideoEncodeAcceleratorProvider() passing
// the pending_receiver<VideoEncodeAcceleratorProvider> received from the
// renderer process.
[EnableIf=is_linux_or_chromeos,
ServiceSandbox=sandbox.mojom.Sandbox.kHardwareVideoEncoding]
[EnableIf=is_chromeos|is_linux,
ServiceSandbox=sandbox.mojom.Sandbox.kHardwareVideoEncoding]
interface VideoEncodeAcceleratorProviderFactory {
// Creates a VideoEncodeAcceleratorProvider and should be called by the
// browser process.
CreateVideoEncodeAcceleratorProvider(
pending_receiver<VideoEncodeAcceleratorProvider> receiver);
pending_receiver<VideoEncodeAcceleratorProvider> receiver);
};
// This defines a mojo transport format used in the
@ -147,8 +145,7 @@ struct VariableBitrate {
uint32 peak_bps;
};
struct ExternalBitrate {
};
struct ExternalBitrate {};
// This defines a mojo transport format for media::Bitrate.
union Bitrate {
@ -163,7 +160,7 @@ struct VideoEncodeAcceleratorConfig {
// See media::VideoEncodeAccelerator::Config::ContentType
enum ContentType {
kCamera,
kDisplay
kDisplay,
};
// See media::VideoEncodeAccelerator::Config::StorageType
@ -221,8 +218,7 @@ interface VideoEncodeAccelerator {
[Sync]
Initialize(VideoEncodeAcceleratorConfig config,
pending_associated_remote<VideoEncodeAcceleratorClient> client,
pending_remote<MediaLog> media_log)
=> (bool result);
pending_remote<MediaLog> media_log) => (bool result);
// Encodes a |frame|, being completely done with it after its callback.
Encode(VideoFrame frame, VideoEncodeOptions options) => ();
@ -241,9 +237,9 @@ interface VideoEncodeAccelerator {
// frame size change only when there is no pending frame in the
// encoder.
RequestEncodingParametersChangeWithLayers(
VideoBitrateAllocation bitrate_allocation,
uint32 framerate,
gfx.mojom.Size? size);
VideoBitrateAllocation bitrate_allocation,
uint32 framerate,
gfx.mojom.Size? size);
// Request a change to the encoding parameters. This method is for use
// with non-layered bitrates, and may make requests for constant or
@ -257,9 +253,7 @@ interface VideoEncodeAccelerator {
// frame size change only when there is no pending frame in the
// encoder.
RequestEncodingParametersChangeWithBitrate(
Bitrate bitrate,
uint32 framerate,
gfx.mojom.Size? size);
Bitrate bitrate, uint32 framerate, gfx.mojom.Size? size);
[Sync]
IsFlushSupported() => (bool result);
@ -312,8 +306,8 @@ struct SVCGenericMetadata {
bool follow_svc_spec;
uint8 temporal_idx;
uint8 spatial_idx;
uint16 ? reference_flags;
uint16 ? refresh_flags;
uint16? reference_flags;
uint16? refresh_flags;
};
// DropFrame or Codec specific metadata.
@ -330,7 +324,7 @@ struct BitstreamBufferMetadata {
mojo_base.mojom.TimeDelta timestamp;
int32 qp;
OptionalMetadata? optional_metadata;
SVCGenericMetadata ? svc_generic;
SVCGenericMetadata? svc_generic;
gfx.mojom.Size? encoded_size;
gfx.mojom.ColorSpace? encoded_color_space;
};
@ -341,8 +335,9 @@ interface VideoEncodeAcceleratorClient {
gfx.mojom.Size input_coded_size,
uint32 output_buffer_size);
BitstreamBufferReady(int32 bitstream_buffer_id,
BitstreamBufferMetadata metadata);
BitstreamBufferReady(
int32 bitstream_buffer_id, BitstreamBufferMetadata metadata);
// VideoEncodeAccelerator calls this when the error occurs and it cannot
// perform encoding any more. |status| represents the detail about the error.
NotifyErrorStatus(EncoderStatus status);

@ -28,11 +28,6 @@ mojom("mojom") {
if (enable_oop_printing) {
mojom("printing_context") {
enabled_features = []
if (is_linux || is_chromeos) {
enabled_features += [ "is_linux_or_chromeos" ]
}
sources = [ "printing_context.mojom" ]
public_deps = [
@ -41,6 +36,7 @@ if (enable_oop_printing) {
"//ui/gfx/geometry/mojom",
]
enabled_features = []
if (enable_oop_printing_no_oop_basic_print_dialog) {
enabled_features += [ "enable_oop_printing_no_oop_basic_print_dialog" ]
}

@ -68,13 +68,15 @@ struct PrintSettings {
PageMargins requested_custom_margins_in_points;
int32 pages_per_sheet;
[EnableIf=is_linux_or_chromeos]
[EnableIf=is_chromeos|is_linux]
map<string, mojo_base.mojom.Value> advanced_settings;
[EnableIf=is_chromeos]
bool send_user_info;
[EnableIf=is_chromeos]
string username;
[EnableIf=is_chromeos]
string pin_value;

@ -31,18 +31,6 @@ mojom("mojom") {
if (enable_ppapi && !is_win) {
enabled_features += [ "enable_ppapi_sandbox" ]
}
if (is_linux || is_mac) {
enabled_features += [ "is_linux_or_mac" ]
}
if (is_linux || is_chromeos) {
enabled_features += [
"has_zygote",
"is_linux_or_chromeos",
]
}
if (is_linux || is_chromeos_ash) {
enabled_features += [ "is_linux_or_chromeos_ash" ]
}
if (enable_cros_libassistant) {
enabled_features += [ "enable_cros_libassistant" ]
}

@ -65,53 +65,42 @@ enum Sandbox {
kSpeechRecognition,
// Like kService but allows loading of the optimization guide library.
[EnableIf=is_linux]
kVideoEffects,
[EnableIf=is_linux] kVideoEffects,
// Like kUtility but allows loading of screen AI library.
[EnableIf=enable_screen_ai_service]
kScreenAI,
[EnableIf=enable_screen_ai_service] kScreenAI,
// The PPAPI plugin process. (Unsandboxed on Windows.)
[EnableIf=enable_ppapi_sandbox]
kPpapi,
[EnableIf=enable_ppapi_sandbox] kPpapi,
// Equivalent to no sandbox on all non-Fuchsia platforms.
// Minimally privileged sandbox on Fuchsia.
[EnableIf=is_fuchsia]
kVideoCapture,
[EnableIf=is_fuchsia] kVideoCapture,
// Allows access to file contents and Windows APIs for parsing icons from PE
// files.
[EnableIf=is_win]
kIconReader,
[EnableIf=is_win] kIconReader,
// Allows LPAC capabilities for the Windws Media Foundation CDM, including
// internet and private network access, COM, Identity & others. Allows access
// to files in the `mediaFoundationCdmFiles` Chromium lpac.
[EnableIf=is_win]
kMediaFoundationCdm,
[EnableIf=is_win] kMediaFoundationCdm,
// Launches elevated. Used by the RemovableStorageWriter.
[EnableIf=is_win]
kNoSandboxAndElevatedPrivileges,
[EnableIf=is_win] kNoSandboxAndElevatedPrivileges,
// Like kUtility, but patches GDI during child startup in pdf_child_init.
[EnableIf=is_win]
kPdfConversion,
[EnableIf=is_win] kPdfConversion,
// Interfaces with operating system print drivers.
[EnableIf=enable_oop_printing]
kPrintBackend,
[EnableIf=enable_oop_printing] kPrintBackend,
// |kXrCompositing| hosts XR Device Service on Windows.
[EnableIf=is_win]
kXrCompositing,
[EnableIf=is_win] kXrCompositing,
// Allows LPAC capabilities for WinHttp. This only needs internet access,
// policy access, and service access.
[EnableIf=is_win]
kWindowsSystemProxyResolver,
[EnableIf=is_win] kWindowsSystemProxyResolver,
// Used to protect processes that perform hardware video decode acceleration.
// Currently uses the same policy as the GPU process sandbox. Warm-up does
@ -123,8 +112,7 @@ enum Sandbox {
// TODO(b/195769334): we're using the GPU process sandbox policy for now as a
// transition step. However, we should create a policy that's tighter just for
// hardware video decoding.
[EnableIf=is_linux_or_chromeos_ash]
kHardwareVideoDecoding,
[EnableIf=is_chromeos_ash|is_linux] kHardwareVideoDecoding,
// Used to protect processes that perform hardware video encode acceleration.
// Currently uses the same policy as the GPU process sandbox. Warm-up does
@ -136,41 +124,33 @@ enum Sandbox {
// TODO(b/248528896): we're using the GPU process sandbox policy for now as a
// transition step. However, we should create a policy that's tighter just for
// hardware video encoding.
[EnableIf=is_linux_or_chromeos]
kHardwareVideoEncoding,
[EnableIf=is_chromeos|is_linux] kHardwareVideoEncoding,
// Hosts Input Method Editors.
[EnableIf=is_chromeos_ash]
kIme,
[EnableIf=is_chromeos_ash] kIme,
// Text-to-speech.
[EnableIf=is_chromeos_ash]
kTts,
[EnableIf=is_chromeos_ash] kTts,
// Hosts the Libassistant service on ChromeOS Ash, only used for
// Chrome branded builds.
[EnableIf=enable_cros_libassistant]
kLibassistant,
[EnableIf=enable_cros_libassistant] kLibassistant,
// Like kUtility but allows access to IOSurface on macOS.
[EnableIf=is_mac]
kMirroring,
[EnableIf=is_mac] kMirroring,
// Used to prime zygotes before they specialize. The process will receive a
// new sandbox later in its lifetime.
[EnableIf=has_zygote]
kZygoteIntermediateSandbox,
[EnableIf=is_chromeos|is_linux] kZygoteIntermediateSandbox,
// Hosts the shared Nearby library for both Nearby Connections and
// Nearby Presence.
[EnableIf=is_chromeos_ash]
kNearby,
[EnableIf=is_chromeos_ash] kNearby,
// Hosts On Device Translation service.
// Currently the sandboxing of the On Device Translation service needs
// a dedicated sandbox type on macOS and Linux.
// On Windows the kService sandbox type is used.
// TODO(crbug.com/340778819): Implement sandboxing on other platforms.
[EnableIf=is_linux_or_mac]
kOnDeviceTranslation,
[EnableIf=is_linux|is_mac] kOnDeviceTranslation,
};

@ -102,10 +102,6 @@ mojom("device_service") {
enabled_features += [ "enable_input_device_manager" ]
}
if (!is_android) {
enabled_features += [ "enable_hid" ]
}
if (enable_compute_pressure) {
enabled_features += [ "enable_compute_pressure" ]
}

@ -21,25 +21,24 @@ import "services/device/public/mojom/usb_manager_test.mojom";
import "services/device/public/mojom/vibration_manager.mojom";
import "services/device/public/mojom/wake_lock_provider.mojom";
[EnableIf=is_android]
import "services/device/public/mojom/nfc_provider.mojom";
[EnableIf=is_chromeos_ash]
import "services/device/public/mojom/mtp_manager.mojom";
[EnableIf=enable_hid]
[EnableIfNot=is_android]
import "services/device/public/mojom/hid.mojom";
[EnableIf=enable_compute_pressure]
import "services/device/public/mojom/pressure_manager.mojom";
[EnableIf=enable_input_device_manager]
import "services/device/public/mojom/input_service.mojom";
[EnableIf=is_chromeos_ash]
import "services/device/public/mojom/mtp_manager.mojom";
[EnableIf=is_android]
import "services/device/public/mojom/nfc_provider.mojom";
[EnableIf=enable_compute_pressure]
import "services/device/public/mojom/pressure_manager.mojom";
// The main interface to the Device Service. This is bound only by the browser
// process and is used to broker connections to more specific device APIs.
interface DeviceService {
// Binds a Fingerprint endpoint.
BindFingerprint(pending_receiver<Fingerprint> receiver);
@ -75,7 +74,7 @@ interface DeviceService {
pending_remote<VibrationManagerListener> listener);
// Binds a HidManager endpoint.
[EnableIf=enable_hid]
[EnableIfNot=is_android]
BindHidManager(pending_receiver<HidManager> receiver);
// Binds a MtpManager endpoint.

@ -18,11 +18,6 @@ mojom_component("mojom") {
"//services/metrics/public/mojom",
]
enabled_features = []
if (is_linux || is_chromeos || is_android) {
enabled_features += [ "private_swap_info" ]
}
cpp_typemaps = [
{
types = [

@ -9,24 +9,23 @@ import "mojo/public/mojom/base/process_id.mojom";
import "mojo/public/mojom/base/time.mojom";
// Common structs:
enum DumpType {
PERIODIC_INTERVAL,
EXPLICITLY_TRIGGERED,
SUMMARY_ONLY
SUMMARY_ONLY,
};
enum LevelOfDetail {
BACKGROUND,
LIGHT,
DETAILED
DETAILED,
};
// Tells the MemoryDumpProvider(s) if they should try to make the result
// more deterministic by forcing garbage collection.
enum Determinism {
NONE,
FORCE_GC
FORCE_GC,
};
enum ProcessType {
@ -36,7 +35,7 @@ enum ProcessType {
GPU,
UTILITY,
PLUGIN,
ARC
ARC,
};
enum MemoryMapOption {
@ -49,13 +48,12 @@ enum MemoryMapOption {
MODULES,
// Fetch information for every single mapped region.
FULL
FULL,
};
// These structs are internal only (only for the communication between
// the service and the ClientProcess library).
// See corresponding types in //base/trace_event for comments.
struct RequestArgs {
uint64 dump_guid;
DumpType dump_type;
@ -161,7 +159,6 @@ struct RawOSMemDump {
};
// These structs are public:
struct OSMemDump {
uint32 resident_set_kb = 0;
@ -182,9 +179,9 @@ struct OSMemDump {
// in kilobytes. For more details, see https://goo.gl/3kPb9S.
uint32 shared_footprint_kb = 0;
// This is private swapped memory in kilobytes reported on Linux and Android
// only.
[EnableIf=private_swap_info]
// This is private swapped memory in kilobytes reported on Linux, ChromeOS and
// Android only.
[EnableIf=is_android|is_chromeos|is_linux]
uint32 private_footprint_swap_kb = 0;
};
@ -247,8 +244,10 @@ interface ClientProcess {
// When |success| == true the dump is appended in the process-local trace
// buffer of the target process and an ACK. A summary of the dump is also
// returned in case of success.
RequestChromeMemoryDump(RequestArgs args) =>
(bool success, uint64 dump_id, RawProcessMemoryDump? raw_process_memory_dump);
RequestChromeMemoryDump(RequestArgs args)
=> (bool success,
uint64 dump_id,
RawProcessMemoryDump? raw_process_memory_dump);
// Requests an OSMemDump for each pid in |pids|.
// The Memory-infra service deals with two kinds of information:
@ -264,8 +263,9 @@ interface ClientProcess {
// On Linux we call this once on the browser process ClientProcess passing
// the pids for all processes.
// See crbug.com/461788
RequestOSMemoryDump(MemoryMapOption option, array<mojo_base.mojom.ProcessId> pids) =>
(bool success, map<mojo_base.mojom.ProcessId, RawOSMemDump> dumps);
RequestOSMemoryDump(
MemoryMapOption option, array<mojo_base.mojom.ProcessId> pids)
=> (bool success, map<mojo_base.mojom.ProcessId, RawOSMemDump> dumps);
};
struct HeapProfileResult {
@ -291,9 +291,9 @@ interface HeapProfiler {
// uploaded to the crash servers - this strips potential PII, but prevents
// symbolization of local builds.
// |write_proto| will additionally write proto heap profiles to traces.
DumpProcessesForTracing(bool strip_path_from_mapped_files,
bool write_proto) =>
(array<HeapProfileResult> results);
DumpProcessesForTracing(
bool strip_path_from_mapped_files, bool write_proto)
=> (array<HeapProfileResult> results);
};
// Implemented by resource_coordinator to provide additional information needed
@ -301,8 +301,8 @@ interface HeapProfiler {
interface HeapProfilerHelper {
// Broadcasts a RequestOSMemoryDump-only request for all registered client
// processes and retrieves only their memory maps.
GetVmRegionsForHeapProfiler(array<mojo_base.mojom.ProcessId> pids) =>
(map<mojo_base.mojom.ProcessId, array<VmRegion>> vm_regions);
GetVmRegionsForHeapProfiler(array<mojo_base.mojom.ProcessId> pids)
=> (map<mojo_base.mojom.ProcessId, array<VmRegion>> vm_regions);
};
// The memory-infra service implements this interface. There is one instance for
@ -321,27 +321,28 @@ interface Coordinator {
RequestGlobalMemoryDump(DumpType dump_type,
LevelOfDetail level_of_detail,
Determinism determinism,
array<string> allocator_dump_names) =>
(bool success, GlobalMemoryDump? global_memory_dump);
array<string> allocator_dump_names)
=> (bool success, GlobalMemoryDump? global_memory_dump);
// Sends a dump request to the client process given by the specified pid and
// returns a summarized dump back or null if there was a failure.
RequestGlobalMemoryDumpForPid(mojo_base.mojom.ProcessId pid,
array<string> allocator_dump_names) =>
(bool success, GlobalMemoryDump? global_memory_dump);
RequestGlobalMemoryDumpForPid(
mojo_base.mojom.ProcessId pid, array<string> allocator_dump_names)
=> (bool success, GlobalMemoryDump? global_memory_dump);
// Requesting a null pid is the same as requesting all pids.
// The returned dump only contains OS metrics. |chrome_allocator_dumps| will
// be empty.
RequestPrivateMemoryFootprint(mojo_base.mojom.ProcessId pid) =>
(bool success, GlobalMemoryDump? global_memory_dump);
RequestPrivateMemoryFootprint(mojo_base.mojom.ProcessId pid)
=> (bool success, GlobalMemoryDump? global_memory_dump);
// Broadcasts a dump request to all registered client processes and injects the
// Broadcasts a dump request to all registered client processes and injects
// the
// dump in the trace buffer (if tracing is enabled).
RequestGlobalMemoryDumpAndAppendToTrace(DumpType dump_type,
LevelOfDetail level_of_detail,
Determinism determinism) =>
(bool success, uint64 dump_id);
Determinism determinism)
=> (bool success, uint64 dump_id);
};
// An interface used by client processes to register themselves with a

@ -10,10 +10,6 @@ mojom_component("mojom") {
macro_prefix = "TRACING_MOJOM"
enabled_features = []
if (is_linux || is_chromeos) {
enabled_features += [ "is_linux_or_chromeos" ]
}
sources = [
"background_tracing_agent.mojom",
"system_tracing_service.mojom",

@ -4,13 +4,13 @@
module tracing.mojom;
[EnableIf=is_perfetto_supported_os]
import "services/tracing/public/mojom/perfetto_service.mojom";
import "sandbox/policy/mojom/context.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
import "services/tracing/public/mojom/traced_process.mojom";
[EnableIf=is_perfetto_supported_os]
import "services/tracing/public/mojom/perfetto_service.mojom";
// Represents a single client process to be traced.
struct ClientInfo {
// The system PID of the process.
@ -20,14 +20,15 @@ struct ClientInfo {
pending_remote<TracedProcess> process;
};
[EnableIf=is_linux_or_chromeos]
[EnableIf=is_chromeos|is_linux]
const sandbox.mojom.Sandbox kTracingSandbox = sandbox.mojom.Sandbox.kUtility;
[EnableIfNot=is_linux_or_chromeos]
[EnableIfNot=is_chromeos|is_linux]
const sandbox.mojom.Sandbox kTracingSandbox = sandbox.mojom.Sandbox.kService;
// The main interface to the Tracing service. This is only consumed by
// privileged clients (e.g. browser process).
[ServiceSandbox=kTracingSandbox,RequireContext=sandbox.mojom.Context.kBrowser]
[ServiceSandbox=kTracingSandbox, RequireContext=sandbox.mojom.Context.kBrowser]
interface TracingService {
// Initializes the service with the current known set of running processes.
Initialize(array<ClientInfo> clients);

@ -42,10 +42,6 @@ mojom("gl") {
}
enabled_features = []
if (!is_android) {
enabled_features += [ "is_not_android" ]
}
if (use_clang_profiling_inside_sandbox) {
enabled_features += [ "use_clang_profiling_inside_sandbox" ]
}

@ -4,42 +4,51 @@
module viz.mojom;
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/protected_buffer_manager.mojom";
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/video_decode_accelerator.mojom";
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/video_decoder.mojom";
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/video_encode_accelerator.mojom";
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/video_protected_buffer_allocator.mojom";
[EnableIf=is_chromeos_ash]
import "components/chromeos_camera/common/mjpeg_decode_accelerator.mojom";
[EnableIf=is_chromeos_ash]
import "components/chromeos_camera/common/jpeg_encode_accelerator.mojom";
import "gpu/ipc/common/client_gmb_interface.mojom";
import "gpu/ipc/common/device_perf_info.mojom";
import "gpu/ipc/common/gpu_disk_cache_type.mojom";
import "gpu/ipc/common/gpu_feature_info.mojom";
import "gpu/ipc/common/gpu_info.mojom";
import "gpu/ipc/common/gpu_peak_memory.mojom";
import "gpu/ipc/common/memory_stats.mojom";
import "gpu/ipc/common/client_gmb_interface.mojom";
import "gpu/ipc/common/shared_image_capabilities.mojom";
import "gpu/ipc/common/surface_handle.mojom";
import "gpu/ipc/common/sync_token.mojom";
import "media/mojo/mojom/video_encode_accelerator.mojom";
import "mojo/public/mojom/base/byte_string.mojom";
import "mojo/public/mojom/base/memory_pressure_level.mojom";
import "mojo/public/mojom/base/process_id.mojom";
import "mojo/public/mojom/base/shared_memory.mojom";
import "services/webnn/public/mojom/features.mojom";
import "services/webnn/public/mojom/webnn_context_provider.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/mojom/buffer_types.mojom";
import "ui/gl/mojom/gpu_preference.mojom";
import "mojo/public/mojom/base/memory_pressure_level.mojom";
import "mojo/public/mojom/base/shared_memory.mojom";
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/protected_buffer_manager.mojom";
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/video_decode_accelerator.mojom";
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/video_decoder.mojom";
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/video_encode_accelerator.mojom";
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/video_protected_buffer_allocator.mojom";
[EnableIf=is_chromeos_ash]
import "components/chromeos_camera/common/jpeg_encode_accelerator.mojom";
[EnableIf=is_chromeos_ash]
import "components/chromeos_camera/common/mjpeg_decode_accelerator.mojom";
[EnableIf=is_win]
import "mojo/public/mojom/base/unguessable_token.mojom";
[EnableIf=is_win]
import "ui/gfx/mojom/dxgi_info.mojom";
@ -50,9 +59,8 @@ interface GpuService {
// synchronously they are available (since the PostTask for
// GpuHost::DidInitialize might not be dispatched yet.
[Sync, NoInterrupt]
EstablishGpuChannel(int32 client_id,
uint64 client_tracing_id,
bool is_gpu_host)
EstablishGpuChannel(
int32 client_id, uint64 client_tracing_id, bool is_gpu_host)
=> (handle<message_pipe>? channel_handle,
gpu.mojom.GpuInfo gpu_info,
gpu.mojom.GpuFeatureInfo gpu_feature_info,
@ -65,8 +73,8 @@ interface GpuService {
// Tells the GPU service an assigned cache handle. Note that for each type of
// handle per client only one unique handle is expected.
SetChannelDiskCacheHandle(int32 client_id,
gpu.mojom.GpuDiskCacheHandle cache_handle);
SetChannelDiskCacheHandle(
int32 client_id, gpu.mojom.GpuDiskCacheHandle cache_handle);
// Called by the browser when the last reference to a GPU disk cache handle
// is gone. Results in the GPU process purging the in memory copy.
@ -83,8 +91,7 @@ interface GpuService {
// Create a new ARC VideoDecoder and binds it to |vd|.
[EnableIf=enable_arc_media]
CreateArcVideoDecoder(
pending_receiver<arc.mojom.VideoDecoder> vd);
CreateArcVideoDecoder(pending_receiver<arc.mojom.VideoDecoder> vd);
// Create a new ARC VideoEncodeAccelerator and binds it to |vea|.
[EnableIf=enable_arc_media]
@ -92,12 +99,12 @@ interface GpuService {
pending_receiver<arc.mojom.VideoEncodeAccelerator> vea);
// Create a new ARC VideoProtectedBufferAllocator and binds it to |pba|.
[EnableIf=enable_arc_media ]
[EnableIf=enable_arc_media]
CreateArcVideoProtectedBufferAllocator(
pending_receiver<arc.mojom.VideoProtectedBufferAllocator> pba);
// Create a new ARC ProtectedBufferManager and binds it to |pbm|.
[EnableIf=enable_arc_media ]
[EnableIf=enable_arc_media]
CreateArcProtectedBufferManager(
pending_receiver<arc.mojom.ProtectedBufferManager> pbm);
@ -129,19 +136,19 @@ interface GpuService {
// Binds the pending receiver.
BindClientGmbInterface(
pending_receiver<gpu.mojom.ClientGmbInterface> receiver, int32 client_id);
pending_receiver<gpu.mojom.ClientGmbInterface> receiver,
int32 client_id);
// Creates a VideoEncodeAcceleratorProvider and binds it to |vea_provider|.
CreateVideoEncodeAcceleratorProvider(
pending_receiver<media.mojom.VideoEncodeAcceleratorProvider>
vea_provider);
pending_receiver<media.mojom.VideoEncodeAcceleratorProvider> vea_provider);
// Binds the pending receiver used to access the hardware accelerated OS
// machine learning APIs.
[RuntimeFeature=webnn.mojom.features.kWebMachineLearningNeuralNetwork]
BindWebNNContextProvider(
pending_receiver<webnn.mojom.WebNNContextProvider>? receiver, int32
client_id);
pending_receiver<webnn.mojom.WebNNContextProvider>? receiver,
int32 client_id);
[Sync, NoInterrupt]
CreateGpuMemoryBuffer(gfx.mojom.GpuMemoryBufferId id,
@ -152,14 +159,13 @@ interface GpuService {
gpu.mojom.SurfaceHandle surface_handle)
=> (gfx.mojom.GpuMemoryBufferHandle buffer_handle);
DestroyGpuMemoryBuffer(gfx.mojom.GpuMemoryBufferId id,
int32 client_id);
DestroyGpuMemoryBuffer(gfx.mojom.GpuMemoryBufferId id, int32 client_id);
// Copies GMB pixel data to |shared_memory|.
// Returns |true| if the copy has succeeded.
CopyGpuMemoryBuffer(gfx.mojom.GpuMemoryBufferHandle buffer_handle,
mojo_base.mojom.UnsafeSharedMemoryRegion shared_memory)
=> (bool success);
mojo_base.mojom.UnsafeSharedMemoryRegion shared_memory)
=> (bool success);
// Returns current video memory usage.
GetVideoMemoryUsageStats() => (gpu.mojom.VideoMemoryUsageStats stats);
@ -171,9 +177,10 @@ interface GpuService {
// Ends tracking the peak GPU memory for the associated |sequence_num|.
// Returning the value of the peak seen since StartPeakMemoryMonitorProcess.
GetPeakMemoryUsage(uint32 sequence_num) => (uint64 memory_usage,
map<gpu.mojom.GpuPeakMemoryAllocationSource, uint64>
memory_per_allocation_source);
GetPeakMemoryUsage(uint32 sequence_num)
=> (uint64 memory_usage,
map<gpu.mojom.GpuPeakMemoryAllocationSource, uint64>
memory_per_allocation_source);
// Requests that the GPU process query DXGI adapter and output information
// and return it.
@ -215,11 +222,12 @@ interface GpuService {
// Called by the browser immediately after the application is backgrounded.
OnBackgrounded();
// Called by the browser immediately after the application is foregrounded.
OnForegrounded();
// Called by the browser when the system is under memory pressure.
[EnableIf=is_not_android]
[EnableIfNot=is_android]
OnMemoryPressure(mojo_base.mojom.MemoryPressureLevel level);
// Begin a batch of layer tree changes.
@ -240,6 +248,8 @@ interface GpuService {
GetDawnInfo(bool collect_metrics) => (array<string> dawn_info_list);
Crash();
Hang();
ThrowJavaException();
};

@ -375,18 +375,9 @@ mojom("mojom_platform") {
}
enabled_features = []
if (is_linux || is_chromeos) {
enabled_features += [ "renderer_pref_system_font_family_name" ]
}
if (use_ozone) {
enabled_features += [ "is_selection_clipboard_buffer_possible" ]
}
if (is_android || is_ios) {
enabled_features += [ "is_using_open_color_chooser" ]
}
if (is_android || is_ios) {
enabled_features += [ "is_android_or_ios" ]
}
shared_cpp_typemaps = [
{

@ -14,12 +14,11 @@ interface ColorChooserFactory {
// OpenColorChooser opens a platform specific color chooser in the browser.
// Enabled on platfoms that opt in using the "is_using_open_color_chooser"
// enabled_features option.
[EnableIf=is_using_open_color_chooser]
OpenColorChooser(
pending_receiver<ColorChooser> chooser,
pending_remote<ColorChooserClient> client,
uint32 color,
array<ColorSuggestion> suggestions);
[EnableIf=is_android|is_ios]
OpenColorChooser(pending_receiver<ColorChooser> chooser,
pending_remote<ColorChooserClient> client,
uint32 color,
array<ColorSuggestion> suggestions);
};
interface ColorChooser {

@ -13,14 +13,20 @@ enum MediaDeviceType {
kMediaAudioInput,
kMediaVideoInput,
kMediaAudioOutput,
kNumMediaDeviceTypes
kNumMediaDeviceTypes,
};
// The values for this enum match the ones defined in
// https://w3c.github.io/mediacapture-main/#def-constraint-facingMode
// with the addition of kNone, which would map to the empty string in
// JavaScript.
enum FacingMode { kNone, kUser, kEnvironment, kLeft, kRight };
enum FacingMode {
kNone,
kUser,
kEnvironment,
kLeft,
kRight,
};
struct MediaDeviceInfo {
string device_id;
@ -48,7 +54,7 @@ enum AudioOutputStatus {
kDeviceNotFound,
kErrorOtherRequestInProgress,
kNotSupported,
kNoUserActivation
kNoUserActivation,
};
struct SelectAudioOutputResult {
@ -147,7 +153,7 @@ interface MediaDevicesDispatcherHost {
// of opportunity from the render side.
// (Note that a timer exists on the browser-side, too. This message serves
// to close the window early.)
[EnableIfNot=is_android_or_ios]
[EnableIfNot=is_android|is_ios]
CloseFocusWindowOfOpportunity(string label);
// Mints a new ID backing a SubCaptureTarget.
@ -155,15 +161,15 @@ interface MediaDevicesDispatcherHost {
// for BrowserCaptureMediaStreamTrack.cropTo().
// * RestrictionTargetIds back a RestrictionTarget, which is the input type
// for BrowserCaptureMediaStreamTrack.restrictTo().
[EnableIfNot=is_android_or_ios]
[EnableIfNot=is_android|is_ios]
ProduceSubCaptureTargetId(media.mojom.SubCaptureTargetType type)
=> (string id);
// SelectAudioOutput prompts the user to select an audio
// output device, returning information about the chosen device.
// The |device_id| argument can be used to pre-select a specific device, if desired.
// The |device_id| argument can be used to pre-select a specific device, if
// desired.
SelectAudioOutput(string device_id) => (SelectAudioOutputResult result);
};
// This object lives in the renderer process and is used by the browser process
@ -173,6 +179,6 @@ interface MediaDevicesListener {
// |device_infos| contains the new list of devices of type |type|, with
// device and group IDs obfuscated according to the subscription's security
// origin.
OnDevicesChanged(MediaDeviceType type,
array<MediaDeviceInfo> device_infos);
OnDevicesChanged(
MediaDeviceType type, array<MediaDeviceInfo> device_infos);
};

@ -50,7 +50,7 @@ enum MediaStreamType {
// TODO(crbug.com/971228): Remove NUM_MEDIA_TYPES, as per the conventions
// in docs/security/mojo.md#do-not-define-placeholder-enumerator-values.
NUM_MEDIA_TYPES
NUM_MEDIA_TYPES,
};
// Elements in this enum should not be deleted or rearranged; the only
@ -75,7 +75,7 @@ enum MediaStreamRequestResult {
DEVICE_IN_USE,
REQUEST_CANCELLED,
START_TIMEOUT,
NUM_MEDIA_REQUEST_RESULTS
NUM_MEDIA_REQUEST_RESULTS,
};
// Type of state change for the corresponding requests.
@ -96,6 +96,7 @@ enum PreferredDisplaySurface {
// This empty struct is used as a union option. Its presence will trigger
// searching only by device ID. There is no other information needed.
struct SearchOnlyByDeviceId {};
struct SearchBySessionId {
// If `session_id_map` contains a mapping for the selected device id, then
// the session will be re-used, otherwise a new session will be created.
@ -187,20 +188,27 @@ enum CapturedSurfaceControlResult {
// notifications or pause requests from the browser process.
interface MediaStreamDeviceObserver {
OnDeviceStopped(string label, MediaStreamDevice device);
OnDeviceChanged(string label,
MediaStreamDevice old_device,
MediaStreamDevice new_device);
// Requests to pause or resume the corresponding media stream device.
OnDeviceRequestStateChange(string label, MediaStreamDevice device, MediaStreamStateChange new_state);
OnDeviceRequestStateChange(string label,
MediaStreamDevice device,
MediaStreamStateChange new_state);
// Informs the renderer-side that a configuration change has been detected in
// the corresponding media stream device.
OnDeviceCaptureConfigurationChange(string label, MediaStreamDevice device);
// Informs the renderer-side that the device's capture handle has changed.
OnDeviceCaptureHandleChange(string label,
MediaStreamDevice device);
OnDeviceCaptureHandleChange(string label, MediaStreamDevice device);
// Informs the renderer-side that captured surface's the zoom-level has
// changed.
OnZoomLevelChange(string label, MediaStreamDevice device, int32 zoom_level);
OnZoomLevelChange(
string label, MediaStreamDevice device, int32 zoom_level);
};
// Contains devices that are assigned to a specific stream. At least one of
@ -239,17 +247,20 @@ interface MediaStreamDispatcherHost {
// `pan_tilt_zoom_allowed`: A flag indicating whether pan / tilt / zoom is
// allowed.
// TODO(crbug.com/1327958): Use expected<T,E> for the return values.
GenerateStreams(int32 request_id, StreamControls controls, bool user_gesture,
StreamSelectionInfo audio_stream_selection_info)
=> (MediaStreamRequestResult result, string label,
StreamDevicesSet? stream_devices,
bool pan_tilt_zoom_allowed);
GenerateStreams(int32 request_id,
StreamControls controls,
bool user_gesture,
StreamSelectionInfo audio_stream_selection_info)
=> (MediaStreamRequestResult result,
string label,
StreamDevicesSet? stream_devices,
bool pan_tilt_zoom_allowed);
// The `focus` bit is `true` if focus should be switched to
// the captured source (tab/window).
// It is an error to set it to `true` for anything other than
// a video track derived from tab/window screen-capture.
[EnableIfNot=is_android_or_ios]
[EnableIfNot=is_android|is_ios]
FocusCapturedSurface(string label, bool focus);
// Cancels the request for a new media stream or opening a device.
@ -260,7 +271,8 @@ interface MediaStreamDispatcherHost {
// `session_id`) has ongoing transfers, in case of transferred
// MediaStreamTracks, the MediaStreamDevice will not stop immediately and
// will be kept alive until all the transfers are complete.
StopStreamDevice(string device_id, mojo_base.mojom.UnguessableToken? session_id);
StopStreamDevice(
string device_id, mojo_base.mojom.UnguessableToken? session_id);
// Opens a device identified by `device_id`.
OpenDevice(int32 request_id, string device_id, MediaStreamType type)
@ -277,7 +289,8 @@ interface MediaStreamDispatcherHost {
// for a user's visit to a malicious web page to compromise a render process
// running a trusted extension to make it report falsehood in this Mojo
// message.
SetCapturingLinkSecured(mojo_base.mojom.UnguessableToken? session_id, MediaStreamType type,
SetCapturingLinkSecured(mojo_base.mojom.UnguessableToken? session_id,
MediaStreamType type,
bool is_secure);
// Start/stop cropping or restricting the video track.
@ -297,22 +310,22 @@ interface MediaStreamDispatcherHost {
// a higher version.)
//
// The callback reports success/failure.
[EnableIfNot=is_android_or_ios]
[EnableIfNot=is_android|is_ios]
ApplySubCaptureTarget(mojo_base.mojom.UnguessableToken session_id,
media.mojom.SubCaptureTargetType type,
mojo_base.mojom.Token sub_capture_target,
uint32 sub_capture_target_version)
=> (media.mojom.ApplySubCaptureTargetResult result);
media.mojom.SubCaptureTargetType type,
mojo_base.mojom.Token sub_capture_target,
uint32 sub_capture_target_version)
=> (media.mojom.ApplySubCaptureTargetResult result);
// Deliver a wheel event from a capturing app to a captured tab.
//
// `session_id` identifies the captured tab.
// `action` is the action (mouse event) to be delivered.
// `callback` will be invoked with the result.
[EnableIfNot=is_android_or_ios]
[EnableIfNot=is_android|is_ios]
SendWheel(mojo_base.mojom.UnguessableToken session_id,
CapturedWheelAction action) =>
(CapturedSurfaceControlResult result);
CapturedWheelAction action)
=> (CapturedSurfaceControlResult result);
// Sets the zoom level of the captured tab.
//
@ -322,17 +335,17 @@ interface MediaStreamDispatcherHost {
//
// TODO(crbug.com/1512609): Create a new device mojo interface to replace the
// use of the device_id token.
[EnableIfNot=is_android_or_ios]
SetZoomLevel(mojo_base.mojom.UnguessableToken session_id,
int32 zoom_level)
=> (CapturedSurfaceControlResult result);
[EnableIfNot=is_android|is_ios]
SetZoomLevel(
mojo_base.mojom.UnguessableToken session_id, int32 zoom_level)
=> (CapturedSurfaceControlResult result);
// Request permission to use Captured Surface Control.
// `session_id` identifies the captured tab.
[EnableIfNot=is_android_or_ios]
[EnableIfNot=is_android|is_ios]
RequestCapturedSurfaceControlPermission(
mojo_base.mojom.UnguessableToken session_id)
=> (CapturedSurfaceControlResult result);
mojo_base.mojom.UnguessableToken session_id)
=> (CapturedSurfaceControlResult result);
// Get a MediaStreamDevice metadata object which refers to the same flow of
// media backing an existing MediaStreamDevice.
@ -351,9 +364,10 @@ interface MediaStreamDispatcherHost {
// context to identify this transfer in the browser process.
// `response` is null if and only if result != OK.
[Sync]
GetOpenDevice(int32 request_id, mojo_base.mojom.UnguessableToken session_id,
GetOpenDevice(int32 request_id,
mojo_base.mojom.UnguessableToken session_id,
mojo_base.mojom.UnguessableToken transfer_id)
=> (MediaStreamRequestResult result, GetOpenDeviceResponse? response);
=> (MediaStreamRequestResult result, GetOpenDeviceResponse? response);
// Keeps a MediaStreamDevice alive even if it has been requested to stop.
//
@ -372,8 +386,8 @@ interface MediaStreamDispatcherHost {
// browser process.
// `device_found` is true if the MediaStreamDevice was found.
KeepDeviceAliveForTransfer(mojo_base.mojom.UnguessableToken session_id,
mojo_base.mojom.UnguessableToken transfer_id)
=> (bool device_found);
mojo_base.mojom.UnguessableToken transfer_id)
=> (bool device_found);
};
// Browser-side interface that is used by the renderer process to notify the

@ -6,8 +6,8 @@ module blink.mojom;
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/time.mojom";
import "ui/gfx/mojom/font_render_params.mojom";
import "third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom";
import "ui/gfx/mojom/font_render_params.mojom";
const int64 kDefaultCaretBlinkIntervalInMilliseconds = 500;
@ -35,7 +35,7 @@ struct RendererPreferences {
// The type of subpixel rendering to use for text.
// Currently only used by Linux and Windows.
gfx.mojom.SubpixelRendering subpixel_rendering =
gfx.mojom.SubpixelRendering.kNone;
gfx.mojom.SubpixelRendering.kNone;
// Whether subpixel positioning should be used, permitting fractional X
// positions for glyphs. Currently only used by Linux.
@ -45,6 +45,7 @@ struct RendererPreferences {
// only used by Windows.
[EnableIf=is_win]
float text_contrast = 0.5;
[EnableIf=is_win]
float text_gamma = 0.0;
@ -54,8 +55,10 @@ struct RendererPreferences {
// The colors used in selection text. Currently only used on Linux and Ash.
// Note: these must match the values in renderer_preferences.h.
uint32 active_selection_bg_color = 0xFF1967D2;
[EnableIf=is_android]
uint32 active_selection_fg_color = 0xFF000000;
[EnableIfNot=is_android]
uint32 active_selection_fg_color = 0xFFFFFFFF;
uint32 inactive_selection_bg_color = 0xFFC8C8C8;
@ -66,7 +69,8 @@ struct RendererPreferences {
// Cursor blink rate.
// On Linux, uses |gtk-cursor-blink| from GtkSettings.
// On platforms with views toolkit, uses the system value from ui::NativeTheme.
// On platforms with views toolkit, uses the system value from
// ui::NativeTheme.
// Note: Null |caret_blink_interval| should be interpreted as the default
// value kDefaultCaretBlinkIntervalInMilliseconds.
mojo_base.mojom.TimeDelta? caret_blink_interval;
@ -113,7 +117,8 @@ struct RendererPreferences {
string accept_languages;
// Whether renderers need to send SubresourceResponseStarted IPC to
// the browser. Renderers send the IPC if user has allowed any certificate or HTTP
// the browser. Renderers send the IPC if user has allowed any certificate or
// HTTP
// exceptions and we keep sending subresource notifications to the browser
// until all HTTPS-related warning exceptions have been revoked and the
// browser is restarted.
@ -125,7 +130,7 @@ struct RendererPreferences {
// Whether or not caret browsing is enabled.
bool caret_browsing_enabled = false;
[EnableIf=renderer_pref_system_font_family_name]
[EnableIf=is_chromeos|is_linux]
string system_font_family_name;
// The default system font settings for caption, small caption, menu and
@ -134,26 +139,31 @@ struct RendererPreferences {
// Win-only mojom struct to avoid using a [EnableIf=is_win] for each of them.
[EnableIf=is_win]
mojo_base.mojom.String16 caption_font_family_name;
[EnableIf=is_win]
int32 caption_font_height = 0;
[EnableIf=is_win]
mojo_base.mojom.String16 small_caption_font_family_name;
[EnableIf=is_win]
int32 small_caption_font_height = 0;
[EnableIf=is_win]
mojo_base.mojom.String16 menu_font_family_name;
[EnableIf=is_win]
int32 menu_font_height = 0;
[EnableIf=is_win]
mojo_base.mojom.String16 status_font_family_name;
[EnableIf=is_win]
int32 status_font_height = 0;
[EnableIf=is_win]
mojo_base.mojom.String16 message_font_family_name;
[EnableIf=is_win]
int32 message_font_height = 0;

@ -377,9 +377,6 @@ mojom("native_handle_types") {
if (is_linux || is_chromeos || use_ozone) {
enabled_features = [ "supports_native_pixmap" ]
}
if (is_linux || is_chromeos) {
enabled_features += [ "is_linux_or_chromeos" ]
}
public_deps = [ "//mojo/public/mojom/base" ]
generate_java = true

@ -23,16 +23,18 @@ struct NativePixmapPlane {
struct NativePixmapHandle {
array<NativePixmapPlane> planes;
[EnableIf=is_linux_or_chromeos]
[EnableIf=is_chromeos|is_linux]
uint64 modifier;
[EnableIf=is_linux_or_chromeos]
[EnableIf=is_chromeos|is_linux]
bool supports_zero_copy_webgpu_import;
[EnableIf=is_fuchsia]
handle<platform> buffer_collection_handle;
[EnableIf=is_fuchsia]
uint32 buffer_index;
[EnableIf=is_fuchsia]
bool ram_coherency;
};

@ -17,14 +17,6 @@ if (chrome_root_store_cert_management_ui) {
public_deps = [ "//mojo/public/mojom/base" ]
webui_module_path = "chrome://resources/cr_components/certificate_manager/"
enabled_features = []
if (is_win || is_mac) {
enabled_features += [ "native_cert_management" ]
}
if (is_win || is_mac || is_linux) {
enabled_features += [ "enable_provisioned_client_certs" ]
}
}
}

@ -20,8 +20,8 @@ interface CertificateManagerPageHandlerFactory {
// Create both the CertificateManagerPage and CertificateManagerPageHandler
// at the same time.
CreateCertificateManagerPageHandler(
pending_remote<CertificateManagerPage> page,
pending_receiver<CertificateManagerPageHandler> handler);
pending_remote<CertificateManagerPage> page,
pending_receiver<CertificateManagerPageHandler> handler);
};
enum CertificateSource {
@ -31,7 +31,7 @@ enum CertificateSource {
// the first source.
// Trusted certs from the Chrome Root Store.
kChromeRootStore=1,
kChromeRootStore = 1,
// Client certificates from the platform store.
kPlatformClientCert,
@ -56,12 +56,10 @@ enum CertificateSource {
// Enterprise provisioned client certificates. Only enabled on platforms
// where that feature is available.
[EnableIf=enable_provisioned_client_certs]
kProvisionedClientCert,
[EnableIf=is_linux|is_mac|is_win] kProvisionedClientCert,
// Extension provided client certificates.
[EnableIf=is_chromeos]
kExtensionsClientCert,
[EnableIf=is_chromeos] kExtensionsClientCert,
// User-added trusted certs.
kUserTrustedCerts,
@ -134,18 +132,20 @@ interface CertificateManagerPageHandler {
ImportCertificate(CertificateSource source) => (ActionResult? result);
// Begin a client certificate import and bind the private key to the TPM.
ImportAndBindCertificate(CertificateSource source) => (ActionResult? result);
ImportAndBindCertificate(CertificateSource source)
=> (ActionResult? result);
// Begin process to delete the certificate from `source` that has the hex
// SHA256 hash `sha256_hash_hex`. The result may be `success` indicating the
// deletion succeeded and the certificate list should be refreshed, `error`
// on failure with an error message to display, or null if the delete was
// cancelled.
DeleteCertificate(CertificateSource source, string display_name,
string sha256_hash_hex) => (ActionResult? result);
DeleteCertificate(
CertificateSource source, string display_name, string sha256_hash_hex)
=> (ActionResult? result);
// Show the platform's native certificate management UI.
[EnableIf=native_cert_management]
[EnableIf=is_mac|is_win]
ShowNativeManageCertificates();
// Set whether to use the OS imported certs or not.