Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2818)

Unified Diff: docs/mojo_in_chromium.md

Issue 1882293005: Specify language for code blocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/mojo_in_chromium.md
diff --git a/docs/mojo_in_chromium.md b/docs/mojo_in_chromium.md
index a80537aa51a72c1d9b12a3b3830cde874a4568ea..c9e71c8dae35f6820cca345214d35f110d0bc556 100644
--- a/docs/mojo_in_chromium.md
+++ b/docs/mojo_in_chromium.md
@@ -95,7 +95,7 @@ the `foo::mojom` namespace to avoid collisions with non-generated typenames.
In this example the generated `frob::mojom::Frobinator` has a single
pure virtual function:
-```
+```cpp
namespace frob {
class Frobinator {
@@ -113,7 +113,7 @@ provides a means of binding pipes to it.
Let's look at some sample code:
-```
+```cpp
// src/components/frob/frobinator_impl.cc
#include "components/frob/public/interfaces/frobinator.mojom.h"
@@ -148,7 +148,7 @@ and it dispatches them to methods on the bound `T` implementation.
for a strongly-typed message pipe endpoint. A common way to create new message
pipes is via the `GetProxy` call defined in `interface_request.h`:
-```
+```cpp
mojom::FrobinatorPtr proxy;
mojom::FrobinatorRequest request = mojo::GetProxy(&proxy);
```
@@ -169,7 +169,7 @@ serializing a corresponding message and writing it to the pipe.
Hence we can put this together to talk to a `FrobinatorImpl` over a pipe:
-```
+```cpp
frob:mojom::FrobinatorPtr frobinator;
frob::FrobinatorImpl impl(GetProxy(&frobinator));
@@ -208,7 +208,7 @@ interface Frobinator {
and update our implementation:
-```
+```cpp
class FrobinatorImpl : public mojom::Frobinator {
public:
// ...
@@ -225,7 +225,7 @@ When the service implementation runs `callback`, the response arguments are
serialized and sent back over the pipe. The proxy on the other end knows how to
read this response and will in turn dispatch it to a callback on that end:
-```
+```cpp
void ShowLevels(int min, int max) {
DLOG(INFO) << "Frobinator min=" << min << " max=" << max;
}
@@ -262,7 +262,7 @@ either bind it to a service implementation of some kind or you will close it, ef
We can build a simple browser-side `FrobinatorImpl` service that has access to a
`BrowserContext` for any frame which connects to it:
-```
+```cpp
#include "base/macros.h"
#include "components/frob/public/interfaces/frobinator.mojom.h"
#include "content/public/browser/browser_context.h"
@@ -305,7 +305,7 @@ class FrobinatorImpl : public mojom::Frobinator {
Now somewhere in the browser we register the Frobinator service with each
`RenderFrameHost` ([this](https://goo.gl/HEFn63) is a popular spot):
-```
+```cpp
frame_host->GetServiceRegistry()->AddService<frob::mojom::Frobinator>(
base::Bind(
&frob::FrobinatorImpl::Create,
@@ -314,7 +314,7 @@ frame_host->GetServiceRegistry()->AddService<frob::mojom::Frobinator>(
And in the render process we can now do something like:
-```
+```cpp
mojom::FrobinatorPtr frobinator;
render_frame->GetServiceRegistry()->ConnectToRemoteService(
mojo::GetProxy(&frobinator));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698