Commit 14a30c21 authored by Etienne Pierre-Doray's avatar Etienne Pierre-Doray Committed by Commit Bot

[TaskScheduler]: Migrate off of AssertBlockingAllowedDeprecated in /chrome/browser/android/webapk

base::AssertBlockingAllowedDeprecated is deprecated in favor of
ScopedBlockingCall, which serves as a precise annotation of
the scope that may/will block.

Please 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: The call might block (e.g. file I/O that might hit in memory cache).
      WILL_BLOCK: The call will definitely block (e.g. cache already checked and now pinging
        server synchronously).
    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().
  - Calls to blocking //base APIs don't need to be annotated
    with ScopedBlockingCall. All blocking //base APIs (e.g. base::ReadFileToString, base::File::Read,
    base::SysInfo::AmountOfFreeDiskSpace, base::WaitableEvent::Wait, etc.) have their
    own internal annotations.

Refer to the top-level CL if necessary :
https://chromium-review.googlesource.com/c/chromium/src/+/1338391

Please CQ if LGTY!

This CL was uploaded by git cl split.

R=dominickn@chromium.org

Bug: 903957
Change-Id: Ib6f8a8c38d1de1673f2a465478c8f3aebb920a8a
Reviewed-on: https://chromium-review.googlesource.com/c/1338491Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Dominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608676}
parent 4d60abd6
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task_runner_util.h" #include "base/task_runner_util.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/scoped_blocking_call.h"
#include "base/timer/elapsed_timer.h" #include "base/timer/elapsed_timer.h"
#include "chrome/browser/android/color_helpers.h" #include "chrome/browser/android/color_helpers.h"
#include "chrome/browser/android/shortcut_helper.h" #include "chrome/browser/android/shortcut_helper.h"
...@@ -276,7 +276,7 @@ bool StoreUpdateRequestToFileInBackground( ...@@ -276,7 +276,7 @@ bool StoreUpdateRequestToFileInBackground(
const std::map<std::string, std::string>& icon_url_to_murmur2_hash, const std::map<std::string, std::string>& icon_url_to_murmur2_hash,
bool is_manifest_stale, bool is_manifest_stale,
WebApkUpdateReason update_reason) { WebApkUpdateReason update_reason) {
base::AssertBlockingAllowedDeprecated(); base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
std::unique_ptr<std::string> proto = BuildProtoInBackground( std::unique_ptr<std::string> proto = BuildProtoInBackground(
shortcut_info, primary_icon, badge_icon, package_name, version, shortcut_info, primary_icon, badge_icon, package_name, version,
...@@ -293,7 +293,7 @@ bool StoreUpdateRequestToFileInBackground( ...@@ -293,7 +293,7 @@ bool StoreUpdateRequestToFileInBackground(
// Reads |file| and returns contents. Must be called on a background thread. // Reads |file| and returns contents. Must be called on a background thread.
std::unique_ptr<std::string> ReadFileInBackground(const base::FilePath& file) { std::unique_ptr<std::string> ReadFileInBackground(const base::FilePath& file) {
base::AssertBlockingAllowedDeprecated(); base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
std::unique_ptr<std::string> update_request = std::make_unique<std::string>(); std::unique_ptr<std::string> update_request = std::make_unique<std::string>();
base::ReadFileToString(file, update_request.get()); base::ReadFileToString(file, update_request.get());
return update_request; return update_request;
......
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