Commit bc09ae58 authored by Etienne Pierre-doray's avatar Etienne Pierre-doray Committed by Commit Bot

[TaskScheduler]: Use ScopedBlockingCall to mark blocking tasks.

This CL uses ScopedBlockingCall to mark blocking calls in /ios/chrome/browser/reading_list.

This CL was created by replacing calls to AssertBlockingAllowed()
with instantiations of ScopedBlockingCall(MAY_BLOCK).
I kindly ask the reviewer to make sure of the following:
  - ScopedBlockingCall is instantiated in a scope with minimal CPU usage.
    If this is not the case, ScopedBlockingCall should be instantiated
    closer to the blocking call. See scoped_blocking_call.h for more
    info. Please let me know when/where the blocking call happens if this needs
    to be changed.
  - Parameter |blocking_type| matches expectation (MAY_BLOCK/WILL_BLOCK). See
    BlockingType for more info. While I assumed MAY_BLOCK by default, that might
    not be the best fit if we know that this callsite is guaranteed to block.
  - The ScopedBlockingCall's scope covers the entirety of the blocking operation
    previously asserted against by the AssertBlockingAllowed().

This CL was uploaded by git cl split.

R=olivierrobin@chromium.org

Bug: 874080
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: If8096b4000f68e37625258c026af2db5f2b94a29
Reviewed-on: https://chromium-review.googlesource.com/1191787Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587972}
parent 8521f642
......@@ -14,7 +14,6 @@
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "components/reading_list/core/offline_url_utils.h"
#include "components/reading_list/core/reading_list_entry.h"
#include "components/reading_list/core/reading_list_model.h"
......@@ -46,7 +45,6 @@ const int kNumberOfFailsBeforeStop = 7;
// Must be called on File thread.
void CleanUpFiles(base::FilePath root,
const std::set<std::string>& processed_directories) {
base::AssertBlockingAllowed();
base::FileEnumerator file_enumerator(root, false,
base::FileEnumerator::DIRECTORIES);
for (base::FilePath sub_directory = file_enumerator.Next();
......
......@@ -13,7 +13,6 @@
#include "base/path_service.h"
#include "base/stl_util.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "components/reading_list/core/offline_url_utils.h"
#include "ios/chrome/browser/chrome_paths.h"
#include "ios/chrome/browser/dom_distiller/distiller_viewer.h"
......@@ -239,7 +238,6 @@ void URLDownloader::FetchPDFFile() {
URLDownloader::SuccessState URLDownloader::SavePDFFile(
const base::FilePath& temporary_path) {
base::AssertBlockingAllowed();
if (CreateOfflineURLDirectory(original_url_)) {
base::FilePath path = reading_list::OfflinePagePath(
original_url_, reading_list::OFFLINE_TYPE_PDF);
......@@ -296,7 +294,6 @@ URLDownloader::SuccessState URLDownloader::SaveDistilledHTML(
const std::vector<dom_distiller::DistillerViewerInterface::ImageInfo>&
images,
const std::string& html) {
base::AssertBlockingAllowed();
if (CreateOfflineURLDirectory(url)) {
return SaveHTMLForURL(SaveAndReplaceImagesInHTML(url, html, images), url)
? DOWNLOAD_SUCCESS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment