Skip to content

Commit

Permalink
[SM][doc] Fix typos and add clarifications
Browse files Browse the repository at this point in the history
Change-Id: Id9fc6a034a810f2a1e986abd31ea65c73044d07e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575920
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#656507}
  • Loading branch information
Oksana Zhuravlova authored and Commit Bot committed May 3, 2019
1 parent 13cc511 commit 0941c08
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/mojo_and_services.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ void MathService::Divide(int32_t dividend,
int32_t divisor,
DivideCallback callback) {
// Respond with the quotient!
callback.Run(dividend / divisor);
std::move(callback).Run(dividend / divisor);
}
} // namespace math
Expand Down Expand Up @@ -525,7 +525,7 @@ GetChromePackagedServiceManifests() {
```
And don't forget to add a GN dependency from
`//chrome/app:packaged_service_manifests` onto
[`//chrome/app:chrome_packaged_service_manifests`](https://cs.chromium.org/chromium/src/chrome/app/BUILD.gn?l=564&rcl=a77d5ba9c4621cfe14e7e1cd03bbae16904f269e) onto
`//chrome/services/math/public/cpp:manifest`!
We're almost done with service setup. The last step is to teach Chromium (and
Expand Down Expand Up @@ -634,6 +634,12 @@ connector->BindInterface(math::mojom::kServiceName,
divider->Divide(
42, 6, base::BindOnce([](int32_t quotient) { LOG(INFO) << quotient; }));
```
*** aside
NOTE: To ensure the execution of the response callback, the DividerPtr
object must be kept alive (see
[this section](/mojo/public/cpp/bindings/README.md#A-Note-About-Endpoint-Lifetime-and-Callbacks)
and [this note from an earlier section](#sending-a-message)).
***
This should successfully spawn a new process to run the `math` service if it's
not already running, then ask it to do a division, and ultimately log the result
Expand Down

0 comments on commit 0941c08

Please sign in to comment.