The existing Get, GetDictionary, and GetList return base::Value pointers
but DCHECK the existence and the type before doing so. In other words,
they assert that the returned pointer is never null.
This CL introduces GetValue, GetDictValue, and GetListValue which return
references to base::Value, base::Value::Dict, and base::Value::List
respectively.
The goal is to migrate all call sites to the new functions and to remove
the old functions subsequently.
Bug: 1302561
Change-Id: Ia19c4da2754b3620b935f15a395c6ade354fe950
Tests: Existing tests
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3687964
Reviewed-by: Dominic Battré <battre@chromium.org>
Reviewed-by: Kristi Park <kristipark@chromium.org>
Commit-Queue: Roland Bock <rbock@google.com>
Cr-Commit-Position: refs/heads/main@{#1017026}
- robolectric_library allows deps on android_library targets.
- Creates an robolectric test sdk target (that still has the @hide
methods and constants that were removed from the normal sdk).
- robolectric_library and junit_binary now compile against the
new robolectric test sdk.
- Robolectric targets now compile against the android 12 robolectric
test sdk (previously android 10).
Bug: 1296632
Change-Id: I0782443a12cf2d4a8bf5bc3b8424a47400a83120
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696549
Auto-Submit: Mohamed Heikal <mheikal@chromium.org>
Owners-Override: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013712}
This lets consumers call pref_service_->GetValueList() instead of
pref_service_->GetList()->GetList(), which improves code readability
and reduces callers' concerns around type safety.
Also add methods to PrefServiceSimple to set defaults by directly
passing in the new types.
Bug: 1187001,1334665
Change-Id: Id79bfa735512c081196699a91f51cb9205b382d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3690091
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: Dominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012123}
This reapplies the rewrite_raw_ptr_fields rewriter on Windows platform.
This change is a merge of the following changes:
PS4 CheckedPtr rewrite generated by
rewrite-multiple-platforms.sh win
on e53bae729d
PS5 manual build fixes
PS7 rebase
Bug: 1073933
Change-Id: Ibe9c70c9b77a24522cea1f197e50cf8180053354
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3682900
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Owners-Override: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011306}
* Structs with user-declared constructors are no longer aggregates.
Delete the declarations.
* u8"" no longer produces const char*. Change to "", which also accepts
UTF-8 literals. This requires a few follow-on conversions/casts.
* Math between disparate enums is deprecated. Use constexprs.
* Various algorithms' lambdas must fit tighter constraints. Add consts.
* Remove some unnecessary qualifications in preparations for later
constexpr changes.
* std::iterator is removed. Expose the type aliases directly.
* Types on both sides of comparison operators should be the same.
Bug: 1284275
Change-Id: Icaed9c2ec7d914cc5aba156133ea34152d8ca606
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3632589
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1001773}
Now that build_java and jni_java have been moved out of base_java's
public_deps and base_java no longer contains annotations, remove deps on
base_java that are now unnecessary (Removed 169/608 base_java deps or ~27.8%).
Bug: 1038372
Change-Id: I520f9cd849c9f142948941af5d7fe108b3d8c390
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3623861
Reviewed-by: Mohamed Heikal <mheikal@chromium.org>
Owners-Override: Peter Wen <wnwen@chromium.org>
Auto-Submit: Peter Wen <wnwen@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#998944}
This CL moves jni_java from base_java's public_dep to a regular dep.
This means that targets which only need jni_java do not need to depend
on the entirety of base_java. A future CL will remove base_java from
targets that no longer need it as a result of this CL and this other CL
for build_java: https://crrev.com/c/3606468
By using dep_operations.py split and then dep_operations.py remove, this
CL avoided adding 326 instances of jni_java across 201 files.
Bug: 1038372
Change-Id: Ifd411a923dc834d37e0a4c80daf5797c355c6f52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3615049
Auto-Submit: Peter Wen <wnwen@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Reviewed-by: Mohamed Heikal <mheikal@chromium.org>
Owners-Override: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#997965}
This CL moves build_java from being a public_dep of base_java to a
regular dep. This means other targets that need to depend on build_java
must do so explicitly. Since build_java and base_java are not closely
related, this de-coupling (and when jni annotations are similarly moved)
will reduce the number of targets that depend on base_java only for its
annotations, thus speeding up builds when making changes to base_java.
By using dep_operations.py, this CL avoided adding build_java to 224+
targets that already depended on base_java across 194 files. There are
more opportunities to remove unnecessary dependencies on build_java, but
that is left for future CLs in order to prioritize removing build_java
from base_java's public_deps.
Initial estimate (after jni_java is similarly moved out of public_deps)
is that we can remove more than 265+ dependencies on base_java across
~153 files.
Bug: 1038372
Change-Id: Ia5acc70af449f10363bd7e123473e0823ce31bb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3606468
Reviewed-by: Mohamed Heikal <mheikal@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Owners-Override: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#996885}
Only fixing callsites that explicitly invoke operator= or the Callback
constructor (to avoid tweaking files that specify it in overrides/etc.)
outside of a comment.
i.e. matching this regex:
'\n *[^/\n][^/\n][^/\n]*base::(Once|Repeating)?(Callback|Closure)( =|\(\))'
and skipping any files that already has a fwd-decl as either:
- 'class (Once|Repeating)?(Callback|Closure);'
- 'base/callback_forward.h'
This is a prereq to remove unused base/task/post_task.h includes in
https://chromium-review.googlesource.com/c/chromium/src/+/3555247
Bug: 1026641
Change-Id: I20f661e4b388b83606359b7fcdebc8cd93095bf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3554741
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#986224}
This change adds support for ChromeSetting extension-controlled prefs
to the existing Prefs crosapi, including get/set/clear functionality.
This allows these prefs to be set from lacros (lacros will use this
crosapi in a future change).
In lacros (outside of this change), we will compute the value of all
extension-controlled prefs. In this change, we write the computed value
inside of ash directly to the extension prefstore. This is OK for these
prefs, because all extensions which modify these prefs will run from
lacros.
Bug: 1218145
Change-Id: If328f40a1f940f23a87e0a9d1b5b540e1d976154
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3063958
Reviewed-by: Erik Chen <erikchen@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Ian Helmke <helmke@google.com>
Cr-Commit-Position: refs/heads/main@{#978920}
Persist standalone browser prefs in ash using json_pref_store.
Delete standalone_browser_pref_store, as it is now unneeded.
Initially it seemed like a standalone_browser_pref_store would be
necessary because, in the case of extension prefs, we write the
prefs to the user pref store. However, reusing json_pref_store seems
simpler in this case; it persists a pref_store to a file which is
exactly what is needed for standalone browser prefs.
Standalone browser prefs are initialised in roughly the same way
as the user_pref_store, as they are both loaded from files.
Bug: 1218145
Change-Id: Ic79c3bedc8164864cbcabe09256767cd7f4c3727
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3381696
Reviewed-by: Jenny Zhang <jennyz@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Ian Helmke <helmke@google.com>
Cr-Commit-Position: refs/heads/main@{#968848}
The PlatformManagementService returns information about the management
of the OS/platform using ManagementStatusProvider. These provider may
require IO or long operations to get the management state. Since that
information is required early at startup, those providers will cache
their values in the local state so that it is quickly accessible at
startup.
Bug: 1238355
Change-Id: I05940fd7897383d3def29b4cbc24070d1b597633
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3413935
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Owen Min <zmin@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Yann Dago <ydago@chromium.org>
Cr-Commit-Position: refs/heads/main@{#968425}
GetList() will be reimplemented in a future CL with an updated
signature, so existing uses need to be renamed out of the way.
Unlike TakeList() and TakeDict(), GetList() is used quite widely. This
CL migrates a number of uses using the following set of automated steps:
sed -i "s|\.GetList()|.GetListDeprecated()|g" \
$(git gs "GetList()" --name-only)
git checkout -- base/values.cc base/values.h
git checkout -- base/values_unittest.cc third_party/dom_distiller_js
git checkout -- tools/clang
git cl format
Bug: 1291666
Change-Id: I0413b4857cbf38943333988e36da53f44aab7a15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3435727
Reviewed-by: danakj chromium <danakj@chromium.org>
Commit-Queue: danakj chromium <danakj@chromium.org>
Owners-Override: danakj chromium <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#966793}
GetList() will be reimplemented in a future CL with an updated
signature, so existing uses need to be renamed out of the way.
Unlike TakeList() and TakeDict(), GetList() is used quite widely. This
CL migrates a number of uses using the following set of automated steps:
sed -i "s|->GetList()|->GetListDeprecated()|g" \
$(git gs "GetList()" --name-only)
git checkout -- base/values_unittest.cc third_party/dom_distiller_js
git cl format
Bug: 1291666
Change-Id: I1b7a92fcb4874e7afb82d4bd092c1c9de2cc3d05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3430698
Reviewed-by: danakj chromium <danakj@chromium.org>
Owners-Override: danakj chromium <danakj@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#966487}
base::DictionaryValue and base::ListValue are deprecated. All users of
DictionaryPrefUpdateDeprecated and ListPrefUpdateDeprecated have been
migrated to the new forms that don't use those deprecated types. So,
this cl removes the old forms and does some consequential clean up.
Bug: 1285745
Change-Id: Ibd0f2417e7944ea6f3979ed2e85a34f60dfb5d41
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3407603
Reviewed-by: Dominic Battré <battre@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#962143}
base::DictionaryValue and base::ListValue are deprecated. To allow for
incremental migration, a "Deprecated" suffix is added to the current
DictionaryPrefUpdate and ListPrefUpdate and new definitions using
base::Value are added. Future cls will convert uses from the old to new
typedefs.
Bug: 1285745
Change-Id: I05654d4ba4206691527f798dc12da3175aa4de37
AX-Relnotes: n/a.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3376154
Reviewed-by: Dominic Battré <battre@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Owners-Override: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#957434}
crbug.com/945772 added a call to DumpWithoutCrashing for leaking
subscribers to default_search_provider_data.template_url_data. 945772
was fixed in M93. It appears iOS has a similar issue, but these reports
are only showing up for iOS in M97 now that iOS is experimenting with
Crashpad. There's another bug (1272165) tracking this new issue, and
given how often this happens triggering a DWC seems unnecessary.
Since the original bug is fixed, removing for now.
Bug: 1272165, 945772, 1283552
Change-Id: Id081be788651e2b9b0155360fced473e814140dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3362646
Auto-Submit: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Dominic Battré <battre@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#956021}
This change adds a LacrosPrefStore for ash. This PrefStore will exist
only in ash and holds prefs sent from lacros to ash. In particular, it
will be used to store extension-controlled prefs.
In a follow-up, this PrefStore will be persisted. It is not persisted or
used in this change.
Bug: 1218145
Change-Id: I4914bd4080841a7148259c368ae0610686d9f862
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3287323
Reviewed-by: Jenny Zhang <jennyz@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Ian Helmke <helmke@google.com>
Cr-Commit-Position: refs/heads/main@{#952575}
Since headless introduced preferences support, it started saving
and reloading the local state automatically, thus persisting local
state changes. This changed the previous expectation that headless
always starts in a known state defined by the default profile.
This change prevents local state changes from being saved.
As a side effect, this change is expected to fix intermittent file
access violations that occur on Windows where headless saves OSCrypt
key in the local state.
Bug: 1237124
Change-Id: I628ef3f86250c436778488a611f2f86e35bf797d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3313465
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Peter Kvitek <kvitekp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#948103}
This CL was generated by using tools/git/move_source_file.py to change
the includes for those files:
base/bind_post_task.h
base/deferred_sequenced_task_runner.h
base/post_task_and_reply_with_result_internal.h
base/sequenced_task_runner.h
base/sequenced_task_runner_helpers.h
base/single_thread_task_runner.h
base/task_runner.h
base/task_runner_util.h
base/updateable_sequenced_task_runner.h
Then formatted using "git cl format". DEPS files were fixed with a
simple search and replace script.
Bug: 1255932
Change-Id: I0d9b5ddd9260fde5e4581e6c6e0080bdb0ed2c44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3209175
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#929867}
This inlines all remaining DISALLOW_* macros in components/. This is
done manually (vim regex + manually finding insertion position).
IWYU cleanup is left as a separate pass that is easier when these macros
go away.
Bug: 1010217
Change-Id: I2409b6250d85e74e8c4b6863fbeeaaeacc37733c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3194821
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/main@{#927361}
This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).
This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.
IWYU cleanup is left as a separate pass that is easier when these macros
go away.
Bug: 1010217
Change-Id: I917bfbff1357e9e2cfe330d242feff6bb73e1bce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3167004
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#923103}