blob: 9ad035de11022b27d8a4dee9f2754c1ad1153c53 [file] [log] [blame] [view]
Ken Rockotab035122019-02-06 00:35:241# Intro to Mojo & Services
2
3[TOC]
4
5## Overview
6
7This document contains the minimum amount of information needed for a developer
8to start using Mojo effectively in Chromium, with example Mojo interface usage,
9service definition and hookup, and a brief overview of the Content layer's core
10services.
11
12See other [Mojo & Services](/docs/README.md#Mojo-Services) documentation
13for introductory guides, API references, and more.
14
15## Mojo Terminology
16
17A **message pipe** is a pair of **endpoints**. Each endpoint has a queue of
18incoming messages, and writing a message at one endpoint effectively enqueues
19that message on the other (**peer**) endpoint. Message pipes are thus
20bidirectional.
21
22A **mojom** file describes **interfaces**, which are strongly-typed collections
23of **messages**. Each interface message is roughly analogous to a single proto
24message, for developers who are familiar with Google protobufs.
25
26Given a mojom interface and a message pipe, one of the endpoints
Darwin Huangb4bd2452019-10-08 22:56:0427can be designated as a **`Remote`** and is used to *send* messages described by
28the interface. The other endpoint can be designated as a **`Receiver`** and is used
Ken Rockotab035122019-02-06 00:35:2429to *receive* interface messages.
30
31*** aside
32NOTE: The above generalization is a bit oversimplified. Remember that the
33message pipe is still bidirectional, and it's possible for a mojom message to
Darwin Huangb4bd2452019-10-08 22:56:0434expect a reply. Replies are sent from the `Receiver` endpoint and received by the
35`Remote` endpoint.
Ken Rockotab035122019-02-06 00:35:2436***
37
Darwin Huangb4bd2452019-10-08 22:56:0438The `Receiver` endpoint must be associated with (*i.e.* **bound** to) an
Ken Rockotab035122019-02-06 00:35:24