summaryrefslogtreecommitdiff
path: root/chromium/codelabs
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-02-04 17:20:24 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-02-12 08:15:25 +0000
commit8fa0776f1f79e91fc9c0b9c1ba11a0a29c05196b (patch)
tree788d8d7549712682703a0310ca4a0f0860d4802b /chromium/codelabs
parent606d85f2a5386472314d39923da28c70c60dc8e7 (diff)
downloadqtwebengine-chromium-8fa0776f1f79e91fc9c0b9c1ba11a0a29c05196b.tar.gz
BASELINE: Update Chromium to 98.0.4758.90
Change-Id: Ib7c41539bf8a8e0376bd639f27d68294de90f3c8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/codelabs')
-rw-r--r--chromium/codelabs/cpp101/codelab.md17
-rw-r--r--chromium/codelabs/cpp101/mojo.cc12
-rw-r--r--chromium/codelabs/cpp101/services/math/math_service.h1
3 files changed, 15 insertions, 15 deletions
diff --git a/chromium/codelabs/cpp101/codelab.md b/chromium/codelabs/cpp101/codelab.md
index c2a9bc49cd0..26a72b26201 100644
--- a/chromium/codelabs/cpp101/codelab.md
+++ b/chromium/codelabs/cpp101/codelab.md
@@ -19,8 +19,9 @@ This tutorial does not assume you have read any of the above,
though you should feel free to peruse them when necessary.
This tutorial will cover information across all of those guides.
-Exercise solutions are available in the `codelabs/cpp101/` directory of the
-Chromium source code. Build all of the example solutions with
+Exercise solutions are available in the [codelabs/cpp101/](
+https://source.chromium.org/chromium/chromium/src/+/main:codelabs/cpp101/)
+directory of the Chromium source code. Build all of the example solutions with
`autoninja -C out/Default codelabs`. You are encouraged to create a new
`base/cpp101/` directory locally if you want to try implementing these
exercises yourself.
@@ -32,17 +33,17 @@ build system to build a simple C++ binary and demonstrates how typical C++
builds are organized within Chromium.
Create a new target in `base/BUILD.gn` for a new executable
-named `codelab_helloworld`. Then write the classic "Hello, world!" program in
+named `codelab_hello_world`. Then write the classic "Hello, world!" program in
C++. You should be able to build it with
-`autoninja -C out/Default codelab_helloworld` and execute it directly by
+`autoninja -C out/Default codelab_hello_world` and execute it directly by
finding the binary within `out/Default`.
Sample execution:
```shell
$ cd /path/to/chromium/src
$ gclient runhooks
-$ autoninja -C out/Default codelab_helloworld
-$ out/Default/codelab_helloworld
+$ autoninja -C out/Default codelab_hello_world
+$ out/Default/codelab_hello_world
Hello, world!
[0923/185218.645640:INFO:hello_world.cc(27)] Hello, world!
```
@@ -57,7 +58,7 @@ and [Git Cookbook](https://chromium.googlesource.com/chromium/src.git/+/main/doc
## Part 1: Using command-line arguments
-We will augment our `codelab_helloworld` binary to parse command-line flags and
+We will augment our `codelab_hello_world` binary to parse command-line flags and
use those values to print messages to the user.
Command-line arguments within Chromium are processed by the
@@ -84,7 +85,7 @@ use `GetSwitchValueASCII()` and friends to retrieve values passed in.
### Exercise 1: Using command-line arguments
-Change `codelab_helloworld` to take a `--greeting` and a `--name` switch.
+Change `codelab_hello_world` to take a `--greeting` and a `--name` switch.
The greeting, if not specified, should default to "Hello",
and the name, if not specified, should default to "World".
diff --git a/chromium/codelabs/cpp101/mojo.cc b/chromium/codelabs/cpp101/mojo.cc
index e51e5f2047c..d0c0e247ad8 100644
--- a/chromium/codelabs/cpp101/mojo.cc
+++ b/chromium/codelabs/cpp101/mojo.cc
@@ -30,14 +30,14 @@ int main(int argc, char* argv[]) {
return -1;
}
- int divisor = 0;
- if (!base::StringToInt(argv[1], &divisor)) {
- LOG(INFO) << argv[0] << ": invalid divisor '" << argv[1] << "'";
+ int dividend = 0;
+ if (!base::StringToInt(argv[1], &dividend)) {
+ LOG(INFO) << argv[0] << ": invalid dividend '" << argv[1] << "'";
return -1;
}
- int dividend = 0;
- if (!base::StringToInt(argv[2], &dividend) || dividend == 0) {
+ int divisor = 0;
+ if (!base::StringToInt(argv[2], &divisor) || divisor == 0) {
LOG(INFO) << argv[0] << ": invalid divisor '" << argv[2] << "'";
return -1;
}
@@ -48,7 +48,7 @@ int main(int argc, char* argv[]) {
math::MathService math_service_impl(
math_service.BindNewPipeAndPassReceiver());
- math_service->Divide(divisor, dividend,
+ math_service->Divide(dividend, divisor,
base::BindOnce(
[](base::OnceClosure quit, int32_t quotient) {
LOG(INFO) << "Quotient: " << quotient;
diff --git a/chromium/codelabs/cpp101/services/math/math_service.h b/chromium/codelabs/cpp101/services/math/math_service.h
index 59442f92a51..2a4e01a6e41 100644
--- a/chromium/codelabs/cpp101/services/math/math_service.h
+++ b/chromium/codelabs/cpp101/services/math/math_service.h
@@ -5,7 +5,6 @@
#ifndef CODELABS_CPP101_SERVICES_MATH_MATH_SERVICE_H_
#define CODELABS_CPP101_SERVICES_MATH_MATH_SERVICE_H_
-#include "base/macros.h"
#include "codelabs/cpp101/services/math/public/mojom/math_service.mojom.h"
#include "mojo/public/cpp/bindings/receiver.h"