blob: 49852f63ab5a9889d09375acb9035642916104d8 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module resource_coordinator.mojom;
import "mojo/common/time.mojom";
import "signals.mojom";
// Any new type here needs to be mirrored between coordination_unit_types.h and
// coordination_unit.mojom, and have mappings between the two defined in
// coordination_unit_struct_traits.h/.cc (see comment in coordination_unit_id.h).
enum CoordinationUnitType {
kFrame,
kPage,
kProcess,
};
struct CoordinationUnitID {
CoordinationUnitType type;
int64 id;
};
// A FrameCoordinationUnit has at most one ProcessCoordinationUnit as its
// parent, at most one PageCoordinationUnit as its parent, at most one
// FrameCoordinationUnit as parent frame, and can have many child frames.
interface FrameCoordinationUnit {
// Mainly used to force a round-trip to the service over the pipe for
// a specific unit, so we don't have to deal with possibly-not-yet-created
// children.
GetID() => (CoordinationUnitID id);
// Add a new binding to an existing FrameCoordinationUnit.
AddBinding(FrameCoordinationUnit& request);
AddChildFrame(CoordinationUnitID cu_id);
RemoveChildFrame(CoordinationUnitID cu_id);
// Property signals.
SetAudibility(bool audible);
SetNetworkAlmostIdle(bool idle);
// Event signals.
OnAlertFired();
OnNonPersistentNotificationCreated();
};
interface PageCoordinationUnit {
// Mainly used to force a round-trip to the service over the pipe for
// a specific unit, so we don't have to deal with possibly-not-yet-created
// children.
GetID() => (CoordinationUnitID id);
// Add a new binding to an existing PageCoordinationUnit.
AddBinding(PageCoordinationUnit& request);
AddFrame(CoordinationUnitID cu_id);
RemoveFrame(CoordinationUnitID cu_id);
// Property signals.
SetVisibility(bool visible);
SetUKMSourceId(int64 ukm_source_id);
// Event signals.
OnFaviconUpdated();
OnTitleUpdated();
OnMainFrameNavigationCommitted();
};
interface ProcessCoordinationUnit {
// Mainly used to force a round-trip to the service over the pipe for
// a specific unit, so we don't have to deal with possibly-not-yet-created
// children.
GetID() => (CoordinationUnitID id);
// Add a new binding to an existing ProcessCoordinationUnit.
AddBinding(ProcessCoordinationUnit& request);
AddFrame(CoordinationUnitID cu_id);
RemoveFrame(CoordinationUnitID cu_id);
// Property signals.
SetCPUUsage(double cpu_usage);
SetExpectedTaskQueueingDuration(mojo.common.mojom.TimeDelta duration);
SetLaunchTime(mojo.common.mojom.Time launch_time);
SetMainThreadTaskLoadIsLow(bool main_thread_task_load_is_low);
SetPID(int64 pid);
};