File: segmentation_internals.mojom

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (89 lines) | stat: -rw-r--r-- 2,834 bytes parent folder | download | duplicates (6)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module segmentation_internals.mojom;

import "mojo/public/mojom/base/time.mojom";

// Status information about the segmentation service.
struct ServiceStatus {
  // Whether the service is initialized.
  bool is_initialized;

  // Initialization status.
  int32 intialization_status;
};

// Information about a segment.
struct SegmentInfo {
  // String representation of the segment ID.
  string segment_name;

  // Int value of the segment ID.
  int32 segment_id;

  // Detailed segmentation information.
  string segment_data;

  // Whether the segment can be executed.
  bool can_execute_segment;

  // Latest result for executing the segment.
  string prediction_result;

  // Timestamp when the prediction result was computed.
  mojo_base.mojom.Time prediction_timestamp;
};

// Information about a segmentation client.
struct ClientInfo {
  // Key uniquely identifies a segmentation client.
  string segmentation_key;

  // Which segment is currently selected.
  string selected_segment;

  // A list of segments needed by this client.
  array<SegmentInfo> segment_info;
};

// Used by the WebUI page to bootstrap bidirectional communication.
interface PageHandlerFactory {
  // The WebUI calls this method when the page is first initialized.
  CreatePageHandler(pending_remote<Page> page, pending_receiver<PageHandler>
    handler);
};

// Browser-side handler for requests from WebUI page.
interface PageHandler {
  // Gets the segmentation service status.
  GetServiceStatus();

  // Executes a segment using available metrics data in the DB.
  ExecuteModel(int32 segment_id);

  // Overwrites the result for the given segment identified by |segment_id|.
  // This will trigger a new round of segment selection and update the existing
  // result in Prefs.
  OverwriteResult(int32 segment_id, float result);

  // Sets the selected segment for the client identified by |segmentation_key|.
  SetSelected(string segmentation_key, int32 optimization_target);
};

// Renderer-side handler for internal page to process the updates from
// the segmentation service.
interface Page {
  // Notifies the page of a status change on the segmentation service.
  // |is_page_controller| indicates whether the service is initialized,
  // |status_flag| indicates the status of various components, see
  // SegmentationPlatformServiceImpl for description of each bit in the flag.
  OnServiceStatusChanged(bool is_initialized,
                         int32 status_flag);

  // Notifies the page when all client info becomes available from the service.
  // |client_info| is an array of all client information stored in the
  // database.
  OnClientInfoAvailable(array<ClientInfo> client_info);
};