Chromium change:
https://chromium.googlesource.com/chromium/src/+/39810e70da06baca176c0cdbc93164be1f980f59
commit 39810e70da06baca176c0cdbc93164be1f980f59
Author: Patrick Monette <pmonette@chromium.org>
Date: Thu Oct 14 18:06:59 2021 +0000
Reland "Move task-related files from base/ to base/task/"
This is a reland of 092c30c5fd4def5a0c63d6f3a8953bd07768dd44
The 2 problematic subrepos have been migrated and a couple late
addition of the old headers were migrated.
Original change's description:
> Move task-related files from base/ to base/task/
>
> The forward headers are updated to point to the new location, and the
> header guards were fixed.
>
> Bug: 1255932
Removes all `Cargo.lock` files except for the one in `build/rust`. As per [The Cargo Book](https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html):
> If you’re building a non-end product, such as a rust library that other rust packages will depend on, put `Cargo.lock` in your `.gitignore`. If you’re building an end product, which are executable like command-line tool or an application, or a system library with crate-type of `staticlib` or `cdylib`, check `Cargo.lock` into `git`. If you're curious about why that is, see ["Why do binaries have `Cargo.lock` in version control, but not libraries?" in the FAQ](https://doc.rust-lang.org/cargo/faq.html#why-do-binaries-have-cargolock-in-version-control-but-not-libraries).
We build all of our Rust FFI components into the browser by tying them into a single crate under `build/rust`. We currently check each FFI's individual `Cargo.lock` into version control as well as `build/rust/Cargo.lock`. By the rules above, only `build/rust/Cargo.lock` should be checked in; we should add the others to `.gitignore` and remove them from the repo.
Replace the unrolled mapping between `HashMap` keys returned by
the feature extractor and the model input vector with a loop,
which is easier to maintain.
Prefer borrows to explicit `clone` calls, and compare element names
against the interned string atoms instead of passing them through
`to_string` which here uses the default implementation via the
`Display` trait, which uses format calls and therefore can be
quite slow.
Unfortunately I don't think much can be done about the HashMap
keys, since `entry()` takes and owned key by value so it can
support insertion.
* Remove Andrius' custom cssparser fork
* Remove backend_ variable since we can pass RewriterType::Readability
directly to the function now.
* Remove dead includes
Prior to CR94 we were able to assume that the URLLoaderThrottle would
outlive the URLLoader. This is no longer the case, so we pass the
result_delegate_ to the loader.
Resolves https://github.com/brave/brave-browser/issues/18151
For sentences that are more than 200 characters (roughly 3 sentences)
truncate the result at the first sentence. Right now some descriptions
are getting prematurely truncated on abbreviations.
Resolves https://github.com/brave/brave-browser/issues/17983
* Use NavigationEntryCommitted() instead of DidNavigationFinish(). We
have no guarantees about the next DidNavigationStart() being called
first.
* Fix throttle unit test
* Make several review requests to SpeedreaderBrowserTest
We add two browser test cases for Speedreader. In these tests
Speedreader is enabled.
(1) Run a readable page through Speedreader. Close the browser and
open it back up. The page should restore as readable.
(2) Navigate to a non-readable page, then to a readable page, then do
a back navigation. The readable state should not "stick".
Previously we were persisting the SpeedreaderExtendedInfoHandler data to
the NavigationEntry in OnDistillComplete(). Since OnDistillComplete() is
called by the throttle, the navigation entry might not be persisted yet,
so the behavior is not defined. On backward navigations we would
sometimes persist to the previous navigation entry, causing bugs where
pages would incorrectly show up as readable. Since we wait for
DidFinishNavigation, we can safely get the last committed navgiation
entry.
* Use the DistillState enum in
SpeedreaderExtendedInfoHandler to de-duplicate logic.
* Move DistillState to speedreader component
* Move SpeedreaderExtendedInfoHandler to speedreader component
* Pass wc_getter to SpeedreaderThrottle instead of creating the
lifetime helper
Uses the webcontents to deliver the result to the correct tab helper. We
might want to follow this up by having the distiller thread return
tuple:
struct DistillResult {
bool success;
std::string buffered_body;
};
If success is ever false we can abort the loader.
When a noscript wrapped image is found, look at preceding and following
siblings. We were getting duplicate images by not deleting the following
images.
Resolves https://github.com/brave/brave-browser/issues/17787