Commit 5e5c6c41 authored by Etienne Pierre-Doray's avatar Etienne Pierre-Doray Committed by Commit Bot

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

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=finnur@chromium.org

Bug: 903957
Change-Id: I461f534870c60e1fc6b9c1c441d388cc99646c10
Reviewed-on: https://chromium-review.googlesource.com/c/1338483Reviewed-by: default avatarFinnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611279}
parent 7106f2d5
......@@ -43,8 +43,6 @@ constexpr base::FilePath::CharType kExternalExtensionJson[] =
std::set<base::FilePath> GetPrefsCandidateFilesFromFolder(
const base::FilePath& external_extension_search_path) {
base::AssertBlockingAllowedDeprecated();
std::set<base::FilePath> external_extension_paths;
if (!base::PathExists(external_extension_search_path)) {
......@@ -235,8 +233,6 @@ ExternalPrefLoader::ExtractExtensionPrefs(base::ValueDeserializer* deserializer,
}
void ExternalPrefLoader::LoadOnFileThread() {
base::AssertBlockingAllowedDeprecated();
auto prefs = std::make_unique<base::DictionaryValue>();
// TODO(skerner): Some values of base_path_id_ will cause
......@@ -273,7 +269,6 @@ void ExternalPrefLoader::LoadOnFileThread() {
void ExternalPrefLoader::ReadExternalExtensionPrefFile(
base::DictionaryValue* prefs) {
base::AssertBlockingAllowedDeprecated();
CHECK(NULL != prefs);
base::FilePath json_file = base_path_.Append(kExternalExtensionJson);
......@@ -311,7 +306,6 @@ void ExternalPrefLoader::ReadExternalExtensionPrefFile(
void ExternalPrefLoader::ReadStandaloneExtensionPrefFiles(
base::DictionaryValue* prefs) {
base::AssertBlockingAllowedDeprecated();
CHECK(NULL != prefs);
// First list the potential .json candidates.
......
......@@ -16,7 +16,6 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "base/version.h"
......@@ -79,7 +78,6 @@ void ExternalRegistryLoader::StartLoading() {
std::unique_ptr<base::DictionaryValue>
ExternalRegistryLoader::LoadPrefsOnBlockingThread() {
base::AssertBlockingAllowedDeprecated();
auto prefs = std::make_unique<base::DictionaryValue>();
// A map of IDs, to weed out duplicates between HKCU and HKLM.
......
......@@ -14,7 +14,6 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/extensions/extension_management.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/load_error_reporter.h"
......@@ -241,8 +240,6 @@ int UnpackedInstaller::GetFlags() {
bool UnpackedInstaller::LoadExtension(Manifest::Location location,
int flags,
std::string* error) {
base::AssertBlockingAllowedDeprecated();
// Clean up the kMetadataFolder if necessary. This prevents spurious
// warnings/errors and ensures we don't treat a user provided file as one by
// the Extension system.
......@@ -267,7 +264,6 @@ bool UnpackedInstaller::LoadExtension(Manifest::Location location,
bool UnpackedInstaller::IndexAndPersistRulesIfNeeded(std::string* error) {
DCHECK(extension());
base::AssertBlockingAllowedDeprecated();
const ExtensionResource* resource =
declarative_net_request::DNRManifestData::GetRulesetResource(extension());
......@@ -301,8 +297,6 @@ bool UnpackedInstaller::IsLoadingUnpackedAllowed() const {
}
void UnpackedInstaller::GetAbsolutePath() {
base::AssertBlockingAllowedDeprecated();
extension_path_ = base::MakeAbsoluteFilePath(extension_path_);
base::PostTaskWithTraits(
......@@ -326,8 +320,6 @@ void UnpackedInstaller::CheckExtensionFileAccess() {
}
void UnpackedInstaller::LoadWithFileAccess(int flags) {
base::AssertBlockingAllowedDeprecated();
std::string error;
if (!LoadExtension(Manifest::UNPACKED, flags, &error)) {
base::PostTaskWithTraits(
......
......@@ -25,7 +25,6 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
......@@ -113,7 +112,6 @@ base::FilePath* g_download_directory_for_tests = NULL;
base::FilePath GetDownloadFilePath(const base::FilePath& download_directory,
const std::string& id) {
base::AssertBlockingAllowedDeprecated();
// Ensure the download directory exists. TODO(asargent) - make this use
// common code from the downloads system.
if (!base::DirectoryExists(download_directory) &&
......
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