0
Commit Graph

520 Commits

Author SHA1 Message Date
Peter Kasting
6552e4c03f Enable size_t truncation warnings in most directories.
Bug: 167187
Change-Id: I757b2469336069ff637de60fde4abeb29bf4d041
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3057921
Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#907277}
2021-07-30 21:54:20 +00:00
Karandeep Bhatia
82e8aa1326 JsonSchemaCompiler: Raise error on invalid platform.
Bug: 1197223
Change-Id: I9287a362cb963622e1f8ae9ff30fdd03a4839558
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3046943
Auto-Submit: Karan Bhatia <karandeepb@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#904874}
2021-07-23 20:07:04 +00:00
Song Fangzhen
7b68fc88b0 CodeHealth: Remove use of DictionaryValue::Remove
This change removes the use of DictionaryValue::Remove and replaces with
Value::RemoveKey() or Value::ExtractKey().

Bug: 1187051
Change-Id: I28a9245285c9c7aa6e5ad89d0430e542d198efbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3008060
Reviewed-by: Joe Downing <joedow@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Auto-Submit: Fangzhen Song <songfangzhen@bytedance.com>
Cr-Commit-Position: refs/heads/master@{#904689}
2021-07-23 09:58:29 +00:00
Maggie Cai
0e72a7b681 [CodeHealth] Remove Append* from tools/json_schema_compiler/.
This CL removes the usage of deprecated ListValue::AppendString(),
ListValue::AppendInteger() and ListValue::AppendBoolean() API from
tools/json_schema_compiler/.

BUG=1187102, 1187099, 1187100

Change-Id: I2d6abf3742e202c62fa8bded33eb1f0803a00c60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3026696
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#902293}
2021-07-16 02:52:16 +00:00
Mahmoud Gawad
5254a61a83 [Telemetry] Introduce chromeos_system_extension
Chrome parses the manifest.json with the new key:
chrome_system_extension.

This is part of building Chrome OS System Extension platform on top of
Chrome Browser Extensions.

Changes:
- Introduce code under the new folder
  //chrome/common/chromeos/extensions:
- chromeos_system_extensions_manifest_handlers.h/cc: that parses
  chromeos_system_extension key).
- chromeos_system_extensions_api_provider.h/cc.
- Introduce the new extensions_type value: chromeos_system_extension in
  Feature Compiler (that runs as part of Chrome).
  - Introduce the new Manifest::Type::TYPE_CHROMEOS_SYSTEM_EXTENSION in
    manifest.h and sets the type in GetTypeFromManifestValue() if
    chromeos_system_extension key exists.
 - Propagate TYPE_CHROMEOS_SYSTEM_EXTENSION in different places where
   needed.

Bug: b:188897824, 1229585
Test: added extension_manifests_chromeos_system_extension_unittest.cc

Change-Id: I4441c7bbe9a920a0dd861ca3638d971432a38779
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2584165
Commit-Queue: Mahmoud Gawad <mgawad@google.com>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Oleh Lamzin <lamzin@google.com>
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: Jesse Doherty <jwd@chromium.org>
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#902206}
2021-07-15 22:49:43 +00:00
Morten Stenshorne
03129fe90d CodeHealth: Avoid ListValue::Clear()
Replace every occurrence with Value::ClearList().

Will follow up with a CL that actually removes ListValue::Clear() when
this one has landed.

Bug: 1187063
Change-Id: Iff16d0f893b7d549012069872de5ffe19a975c22
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3006068
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Reviewed-by: Michael Crouse <mcrouse@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Reviewed-by: Xiaoqian Dai <xdai@chromium.org>
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Evan Liu <evliu@google.com>
Reviewed-by: Yuchen Liu <yucliu@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900907}
2021-07-13 08:57:37 +00:00
Alex Rudenko
a590ed2cea Code health: replace deprecated base methods in generated code
Bug: chromium:1187004
Change-Id: I338e05e237f37cea55a46de19a30a8eb85b8f770
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3009337
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900861}
2021-07-13 06:37:22 +00:00
Thomas Lukaszewicz
1aaf4253b0 CodeHealth: Remove use of Value::GetAs*
This change removes the use of Value::GetAs* and replaces with
Value::is_*(), Value::Get*(), Value::GetIf*().

Bug: 1187003, 1187006, 1187007
Change-Id: Idcefdb56d3438c42738e9dbbf046723c38da8e6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3022522
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900737}
2021-07-13 00:08:21 +00:00
Hans Wennborg
e93e9b2565 Reland "[base] Don't include <ostream> in string_piece.h"
This is a reland of 472bf833d1
Includes fix for fuchsia-x64-dbg in
components/viz/service/surfaces/surface_reference.cc

Original change's description:
> [base] Don't include <ostream> in string_piece.h
>
> It's not needed, and adds ca 200 MB of compiler input to the build.
>
> This also adds an implementation of CHECK_OP's "argument stringification"
> function for std::string values, since those previously relied on
> operator<< for stringification which would now require including
> <ostream> in many new files.
>
> Bug: 242216
> Change-Id: I34807204a82e622e50a5bbcabb7055c0b2f51f21
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3009579
> Commit-Queue: Hans Wennborg <hans@chromium.org>
> Reviewed-by: danakj <danakj@chromium.org>
> Owners-Override: danakj <danakj@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#900025}

Cq-Include-Trybots: luci.chromium.try:fuchsia-compile-x64-dbg
Bug: 242216
Change-Id: Ibdf16a1ec0307bd94aed2bfb327b7c64317e96bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3015330
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900528}
2021-07-12 16:58:29 +00:00
Maksim Sadym
8b63f395a9 CodeHealth: Remove use of Value::GetAsDouble
This change removes the use of Value::GetAsDouble
and replaces with Value::is_double(), Value::GetDouble(),
Value::GetIfDouble().

tools/json_schema_compiler/util.cc

Bug: 1187006
Change-Id: Id22e104cff0bb3280975f4a0c9d3613055ea929b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3015324
Auto-Submit: Maksim Sadym <sadym@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900477}
2021-07-12 15:02:29 +00:00
Peter Williamson
1e83eef107 Revert "[base] Don't include <ostream> in string_piece.h"
This reverts commit 472bf833d1.

Reason for revert: Breaks the build.
https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8842170960527832208/+/u/compile/stdout?format=raw

It looks like surface_reference.cc didn't get a complete definition of string

Original change's description:
> [base] Don't include <ostream> in string_piece.h
>
> It's not needed, and adds ca 200 MB of compiler input to the build.
>
> This also adds an implementation of CHECK_OP's "argument stringification"
> function for std::string values, since those previously relied on
> operator<< for stringification which would now require including
> <ostream> in many new files.
>
> Bug: 242216
> Change-Id: I34807204a82e622e50a5bbcabb7055c0b2f51f21
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3009579
> Commit-Queue: Hans Wennborg <hans@chromium.org>
> Reviewed-by: danakj <danakj@chromium.org>
> Owners-Override: danakj <danakj@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#900025}

Bug: 242216
Change-Id: Ib735d7e6687dabca68f0073920f568679cb03bdb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3017486
Auto-Submit: Peter Williamson <petewil@chromium.org>
Reviewed-by: Peter Williamson <petewil@chromium.org>
Reviewed-by: Roger Tawa <rogerta@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Roger Tawa <rogerta@chromium.org>
Owners-Override: Peter Williamson <petewil@chromium.org>
Owners-Override: Roger Tawa <rogerta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900045}
2021-07-09 17:06:45 +00:00
Hans Wennborg
472bf833d1 [base] Don't include <ostream> in string_piece.h
It's not needed, and adds ca 200 MB of compiler input to the build.

This also adds an implementation of CHECK_OP's "argument stringification"
function for std::string values, since those previously relied on
operator<< for stringification which would now require including
<ostream> in many new files.

Bug: 242216
Change-Id: I34807204a82e622e50a5bbcabb7055c0b2f51f21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3009579
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900025}
2021-07-09 15:34:54 +00:00
Lei Zhang
d4a2f8e1ed Swap base/stl_util.h to base/cxx17_backports.h in many files.
Files that use base::size() and base::data() should use
cxx17_backports.h directly, instead of getting it transitively through
stl_util.h.

Bug: 1210983
Change-Id: Icc5f425c23ef4e69283293e0d0d6d733fe3b4ba1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2974072
Reviewed-by: Nico Weber <thakis@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#899418}
2021-07-08 03:43:28 +00:00
Song Fangzhen
12b19d341f CodeHealth: Remove use of DictionaryValue::Set in tools/json_schema_compiler/test
This change removes the use of DictionaryValue::Set and replaces with
Value::SetKey() or Value::SetPath().

Bug: 1187023
Change-Id: I6875ada53fa8c41bd4f5e1f42fc964964f02772d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2972037
Auto-Submit: Fangzhen Song <songfangzhen@bytedance.com>
Commit-Queue: Fangzhen Song <songfangzhen@bytedance.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#894584}
2021-06-22 08:56:49 +00:00
Toshiaki Tanaka
62194bf0c7 Fix build fail due to encoding error
In Japanese version Windows, python opens file in cp932 codec as a
default codec.
The idl_schema.py opens a file without specifying the encoding, so
python opened a file as cp932 codec, but it was actually utf-8 encoded.
This is the cause of the build fail.
I fixed the error by specifying 'utf-8' encoding when opening a file.

Bug: 1211760
Change-Id: Ibd3ab33cf3ea04d39f7481a8c39083d0627975ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2962174
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Toshiaki Tanaka <zokutyou2@gmail.com>
Cr-Commit-Position: refs/heads/master@{#893309}
2021-06-17 05:42:11 +00:00
Song Fangzhen
bbab6c56bd Remove DictionaryValue::GetWithoutPathExpansion
After removing the use of
DictionaryValue::GetWithoutPathExpansion, now
DictionaryValue::GetWithoutPathExpansion itself should be
removed.

Bug: 1187041
Change-Id: Ib608897bcc91a3aadfb15dc98c4448d70ab1677e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2939848
Commit-Queue: Nico Weber <thakis@chromium.org>
Auto-Submit: Fangzhen Song <songfangzhen@bytedance.com>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#889295}
2021-06-04 15:14:31 +00:00
Ari Chivukula
f89535e101 Python3Migration-PresubmitChecks: json_schema_compiler
This CL is part of a larger effort to deprecate python2 in PRESUBMIT.
json_schema_compiler's PRESUBMIT file will now run unit tests in
python3. In order to do this, every file's #! must specify python3
(in this dir, most were ambiguous and simply said python).

Bug: 1212101
Change-Id: I870ac1cc70325c79bccfd3df3d37432f24b97f54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2921953
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Cr-Commit-Position: refs/heads/master@{#887392}
2021-05-27 23:36:06 +00:00
Lei Zhang
cbe39c092f Generate slightly better .cc files with json_schema_compiler.
- Make the include ordering more like the Chromium style.
- Include STL headers actually in use. Remove <set> which is not.
- Do not generate calls to std::vector::reserve(0).

Change-Id: I255f43b0c146513ebe156ea21293f488094d18a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2911298
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#886066}
2021-05-24 21:02:51 +00:00
John Palmer
ab8812a665 [COIL] Change chromium code search type links to use main rather than master for tools
See this doc: go/chromium-coil-change for more info
    BUG=1210385

Change-Id: I8fdcbf7d7607ac75f4a84d1d697eedede92e6b6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2902346
Auto-Submit: John Palmer <jopalmer@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Jesse Doherty <jwd@chromium.org>
Commit-Queue: Jesse Doherty <jwd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#885533}
2021-05-21 17:03:43 +00:00
Sylvain Defresne
48e69b766f [owners] Ensure OWNERS file ends with newline in //tools
Some OWNERS file ends with a newline character, some don't. As
text editor tends to add newline at the end of text files when
saving, normalize all OWNERS files to end with a newline '\n'.

Bug: none
Change-Id: I7eec0eaf1f39ba333767bdcd686a4f499338c568
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2905626
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#884966}
2021-05-20 11:21:06 +00:00
Takuto Ikuta
d53301c775 json_schema_compiler: use python3 in json_schema_api.gni
Fixed: 1205586
Change-Id: Ia23e52b7f6dc2bb7cd450e7a2621587bf17c3e3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2905170
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#884405}
2021-05-19 11:38:04 +00:00
Takuto Ikuta
1810ba9132 json_schema_compiler: use python3 for feature_compiler.py
Fixed: 1205587
Change-Id: I31db44af23f9b56725e6a5aecd2c80d6a33cad2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2905318
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#884374}
2021-05-19 11:19:30 +00:00
Lei Zhang
b341a0788d Mention json_schema_compiler in files it generates.
Help make it more obvious what tool is taking .idl files and turning
them into C++ code.

Change-Id: I160560d46313fb72d10bacb37d0fbba8ab8af630
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2901738
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#884093}
2021-05-18 19:45:02 +00:00
Lei Zhang
d380dd2325 Change Results::Create() return type in json_schema_compiler.
Return std::vector<base::Value> instead of
std::unique_ptr<base::ListValue>. Then update affected extensions code
to either switch to std::vector<base::Value>, or add adaptor calls.

Bug: 1139221
Change-Id: Ib37969dda8d84fb71663d7ed213ee02a3900a160
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2496181
Reviewed-by: Luke Halliwell <halliwell@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#884057}
2021-05-18 18:52:36 +00:00
Anders Hartvoll Ruud
7e6cae4445 Remove CreateValueFromOptionalArray
We currently generate code that takes CreateValueFromOptionalArray's
return value and passes it directly to SetWithoutExpansion. This is
(in isolation) probably not great, since storing nullptr in a
DictionaryValue makes it non-serializable (i.e. crashes).

With the new base::Value (Bug 1187001), passing a nullptr-able value to
SetWithoutExpansion has no equivalent, therefore something needs to
change.

We could make CreateValueFromOptionalArray return base::Optional and
adjust call-sites accordingly, however, since it appears that each
of CreateValueFromOptionalArray's call-sites already has an if-guard
which guarantees that it never returns nullptr, I suggest we just
remove it instead.

This is tiny step in the base::Value refactor project (Bug 1187001).

Bug: 1187097
Change-Id: Ie07b033b434a90ed3c3c82e41b39c8d79a370770
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897045
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883871}
2021-05-18 09:11:48 +00:00
Song Fangzhen
3c83dc7901 CodeHealth: Remove use of DictionaryValue::SetWithoutPathExpansion
This change removes the use of DictionaryValue::SetWithoutPathExpansion
and replaces with Value::SetKey()

Bug: 1187031
Change-Id: Idb5b0edb01ad12543c45b5e63a363d0e533f7a74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2892229
Auto-Submit: Fangzhen Song <songfangzhen@bytedance.com>
Commit-Queue: Fangzhen Song <songfangzhen@bytedance.com>
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Reviewed-by: Filip Gorski <fgorski@chromium.org>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Josh Nohle <nohle@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883776}
2021-05-18 03:38:42 +00:00
Anton Bikineev
4078042d18 third_party,tools: Replace base::Optional with absl::optional
This replaces:
- base::Optional -> absl::optional
- include "base/optional.h"
  ->
  include "third_party/abseil-cpp/absl/types/optional.h"
- base::nullopt -> absl::nullopt
- base::make_optional -> absl::make_optional

This also tries to fix gdb and msvc printers.

Bug: 1202909
Change-Id: I2431990da1671751a5d804be162655f086bde8cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2896995
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883301}
2021-05-16 01:16:56 +00:00
Anders Hartvoll Ruud
2c4b29ccd9 Remove base::ListValue::AppendDouble
Fixed: 1187101
AX-Relnotes: n/a
Change-Id: Ieb5a44fbb89c94b522dced0d4aafdc5d9ad8cd5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2885266
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Matt Jones <mdjones@chromium.org>
Reviewed-by: weiliangc <weiliangc@chromium.org>
Reviewed-by: Rachel Blum <groby@chromium.org>
Reviewed-by: Renjie Tang <renjietang@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Filip Gorski <fgorski@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883236}
2021-05-15 01:19:41 +00:00
Song Fangzhen
b4df3b0ea5 CodeHealth: Remove use of DictionaryValue::empty in /tools/json_schema_compiler
This change removes the use of DictionaryValue::empty()
and replaces with Value::DictEmpty()

This CL was uploaded by git cl split.

R=rdevlin.cronin@chromium.org

Bug: 1187020
Change-Id: I87293aedd57c236f3dafc1a56f8b68c74770e87a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2880407
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Auto-Submit: Fangzhen Song <songfangzhen@bytedance.com>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#881179}
2021-05-10 19:53:07 +00:00
David Bertoni
b1d048d0c2 [CodeHealth] Remove uses of ListValue::begin()/end() in /tools/json_schema_compiler.
This CL removes calls to these deprecated member functions. It also
converts to the newer "for" loop syntax when possible, along with
other minor cleanup.

This CL was uploaded by git cl split.

R=rdevlin.cronin@chromium.org

Bug: 1187107
Change-Id: I3c482bba05859baaf092cff633f5ac2b388bc172
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2877407
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#879938}
2021-05-06 18:14:50 +00:00
Peter Kasting
441b32c8b4 Narrow usage of UTF8ToUTF16 in generated .cc files.
This avoids passing compile-time constants to the conversion function,
which will be banned in the future.  (It should also be fractionally
more efficient to boot.)

Bug: 1189439
Change-Id: If9e17eed8c113203fb94bc68a79b03c78adf2bd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2873889
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#879623}
2021-05-06 00:06:34 +00:00
Austin Sullivan
42a87be42a [Code Health] Remove uses of Value::CreateDeepCopy()
This CL was uploaded by git cl split.

R=rdevlin.cronin@chromium.org

Bug: 1187013
Change-Id: I08df010c22da04301004bc11059d0b765bc0e962
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2873790
Auto-Submit: Austin Sullivan <asully@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#879501}
2021-05-05 19:53:03 +00:00
Ayu Ishii
fe46fd3556 CodeHealth: Remove use of Value::GetAsBoolean
This change removes the use of Value::GetAsBoolean
and replaces with Value::is_bool(), Value::GetBool(),
Value::GetIfBool().

Bug: 1187003
Change-Id: Ie11137a1fe5d739a3cd932eb9d6213a046282804
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2869287
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#879054}
2021-05-04 20:47:27 +00:00
David Bertoni
f5e2501e59 [CodeHealth] Change code gen for ListValue iteration.
This CL changes the JSON schema compiler to emit ListValue::GetList()
in "for" loop iteration instead of relying on ListValue::begin() and
ListValue::end(), which are deprecated.

Bug: 1187107
Change-Id: I9efa51561345ed5be2b7a7270b83b71b3d152386
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2866670
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#878660}
2021-05-03 23:55:19 +00:00
Karandeep Bhatia
6d5a1c326c JsonSchemaCompiler: Support schemas identifiers starting with digits.
Support type and variable names in schemas which begin with digits. Do
this by prepending an underscore to the generated variable or type name.
This will be useful for supporting manifest keys like "icons" and
"requirements".

Bug: 1113513

Change-Id: I7ea285979ea9c8117dc49ceff1415d8b6f2f21bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2844545
Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#877790}
2021-04-30 05:12:10 +00:00
Karandeep Bhatia
b1db643566 JsonSchemaCompiler: Support enum arrays in automated manifest parsing.
Bug: 1113513

Change-Id: I5054cc04a73cf5ce4b5eed66a16bd51fe73f92b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2844539
Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#877750}
2021-04-30 02:01:32 +00:00
Minoru Chikamune
e621b61565 CodeHealth: Remove use of Value::GetAsInteger
This change removes the use of Value::GetAsInteger and replaces with
Value::is_int(), Value::GetInt(), Value::GetIfInt().

Bug: 1187004
Change-Id: Ic6ce1ab0723c2f8ca99d995f250a00e331b2a9c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2831555
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Minoru Chikamune <chikamune@chromium.org>
Cr-Commit-Position: refs/heads/master@{#873595}
2021-04-17 02:31:34 +00:00
Minoru Chikamune
ba97678f32 CodeHealth: Remove use of Value::GetAsInteger
This change removes the use of Value::GetAsInteger and replaces with
Value::is_int(), Value::GetInt(), Value::GetIfInt().

Bug: 1187004
Change-Id: I9406a8c924c2322c78ba4b8601ea648b7fb936c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2830520
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Minoru Chikamune <chikamune@chromium.org>
Cr-Commit-Position: refs/heads/master@{#873593}
2021-04-17 02:30:29 +00:00
Minoru Chikamune
c5e2e5e816 CodeHealth: Remove use of Value::GetAsInteger
This change removes the use of Value::GetAsInteger and replaces with
Value::is_int(), Value::GetInt(), Value::GetIfInt().

Bug: 1187004
Change-Id: If41e925b14a7ec3d9d2c0eeeefff7d65f47a0b76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2831129
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Minoru Chikamune <chikamune@chromium.org>
Cr-Commit-Position: refs/heads/master@{#873578}
2021-04-17 02:22:23 +00:00
Peter Boström
6b70182c21 Apply modernize-make-unique for ChromeOS
This picks up make_unique changes for target_os = "chromeos" which were
not hit on my previous Mac build.

This is a large-scale change: go/chromium-modernize-make-unique

Bug: 1194272
Change-Id: Ia5c355daecbcb0c81d69db746c97c9f321b22bae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2826514
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#872701}
2021-04-15 03:53:08 +00:00
Tim Judkins
8e91f0ae18 [Extensions] Remove redundant "optional": false from extension schemas
Several extension API schemas contained properties marking arguments as
"optional": false. However this is the default if "optional" is not
specified, so this CL removes those instances to clean things up.

Also adds a function to model.py that can be used to raise a parse error
for cases like this.

Bug: N/A
Change-Id: Ia1e21a8337df81bed3361d02fa87c5c052c328dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2776044
Commit-Queue: Tim Judkins <tjudkins@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#867298}
2021-03-29 22:30:44 +00:00
Ben Pastene
dbeeb4defb Convert all build scripts that fail on py3 in CrOS chroot to py2.
These are all the build-time scripts that fail during a build of chrome
in the CrOS chroot when switching the default action() to python3.

Bug: 1112471
Tbr: akihiroota@chromium.org
Change-Id: Ie8bf6a0ad0dbf29f75ada7f41f864177f5ef543a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2783231
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#866878}
2021-03-26 01:13:10 +00:00
Jan Wilken Dörrie
c92a6d724d [LSC] Remove base::ASCIIToUTF16("...")
This change removes calls to base::ASCIIToUTF16 with a single-line
string literal and replaces them with a u"..." literal instead. Files
where this change would cause compilation errors were not changed.

This is a mechanical change:

$ git grep -lw ASCIIToUTF16 | xargs \
    sed -i 's/\(base::\)\?ASCIIToUTF16(\("\(\\.\|[^\\"]\)*"\))/u\2/g'
$ git cl format

Bug: 1189439
Change-Id: I1097cc61165b2fcdc86755cff11f5edeb3b0270f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2780659
Commit-Queue: danakj <danakj@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#865709}
2021-03-23 17:43:48 +00:00
Karandeep Bhatia
c9d6f5db90 JsonSchemaCompiler: Remove the chromeos_touch platform.
It's unused and we don't handle it anyway while generating platform
specific conditional includes in _GetPlatformIfdefs.

BUG=None

Change-Id: Ia1ff4b438faf11ba1bae779330bd25ba6bb6ed7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2776256
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#865405}
2021-03-22 22:55:17 +00:00
Karandeep Bhatia
30793377dc JSONSchemaCompiler: Support restricting platform availability for functions in idl.
This already works for json schemas. IDL schema currently only supports
specifying platform availability on namespaces. Also support it for
other IDL nodes (in particular functions).

BUG=1189892

Change-Id: Id8ee8b0e0fbfa3846eecd4bd4c3b326a731793d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2773826
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#865358}
2021-03-22 21:23:09 +00:00
Jan Wilken Dörrie
09a4396a44 [LSC] Remove base/strings/string16.h #includes
This change removes #includes of base/strings/string16.h from the
codebase.

Bug: 1184339
Change-Id: I3b29dd94c6955d01029d24f88177b755863c865d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2756167
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Owners-Override: Jan Wilken Dörrie <jdoerrie@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#862683}
2021-03-14 19:20:08 +00:00
Dirk Pranke
f5a4cf9935 Python3 compat fix to //tools/json_schema_compiler/json_schema.py.
Bug: 1112471
Change-Id: Ic9fb086f877eb400acd7ae86a90a79643096e87a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2753333
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#862297}
2021-03-12 04:20:58 +00:00
Jan Wilken Dörrie
739ccc2128 [LSC] Replace base::string16 with std::u16string in //[f-z]*
This change replaces base::string16 with std::u16string in //[f-z]*

Reproduction steps:
$ git grep -lw 'base::string16' [f-z]* | \
      xargs sed -i 's/\bbase::string16\b/std::u16string/g'
$ git cl format

Bug: 1184339
Change-Id: I4e0ff2fd300c9fd9360dbf8f4b44e74f5f511797
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2752148
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Owners-Override: Jan Wilken Dörrie <jdoerrie@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#862044}
2021-03-11 18:13:05 +00:00
Jan Wilken Dörrie
ad587c3edb [LSC] Add #include <string> to prepare for removal of base::string16
This change adds #include <string> to files currently including
"base/strings/string16.h". This prepares these files for the planned
removal of the base::string16 alias.

In order to adhere to the style guide [1] the following logic was
performed:

* Insert into an existing block of C++ STL includes, if possible
* Else insert `#include <string>` followed by a newline before the first
  #include "some_header.h" line that is not referring to a matching header
  (only relevant for implementation and test files)

[1] https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes

Bug: 1184339
Change-Id: I96660fec3fff0192d53e9728bbbae86228a52c58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2749296
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Owners-Override: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#861966}
2021-03-11 14:09:27 +00:00
Tim Judkins
5cc65b8fae Replace WHITELIST with FILE_PATTERN in json_schema_compiler presubmit
Bug: 842296
Change-Id: Iebb924f32c88d4c93ce3fd2c0397b826985e38e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2718683
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Tim Judkins <tjudkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#857465}
2021-02-25 01:06:30 +00:00