Commit 08ccbf36 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/browser_state.

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

Bug: 874080
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I84da700fb1fc68393c2f5483c96895e8cc6b4d63
Reviewed-on: https://chromium-review.googlesource.com/1191141Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587619}
parent 7e0184ab
......@@ -14,7 +14,7 @@
#include "base/sequenced_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/scoped_blocking_call.h"
#include "components/browser_sync/profile_sync_service.h"
#include "components/invalidation/impl/profile_invalidation_provider.h"
#include "components/password_manager/core/browser/password_store.h"
......@@ -47,6 +47,7 @@ namespace {
int64_t ComputeFilesSize(const base::FilePath& directory,
const base::FilePath::StringType& pattern) {
base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
int64_t running_size = 0;
base::FileEnumerator iter(directory, false, base::FileEnumerator::FILES,
pattern);
......@@ -57,7 +58,6 @@ int64_t ComputeFilesSize(const base::FilePath& directory,
// Simple task to log the size of the browser state at |path|.
void BrowserStateSizeTask(const base::FilePath& path) {
base::AssertBlockingAllowed();
const int64_t kBytesInOneMB = 1024 * 1024;
int64_t size = ComputeFilesSize(path, FILE_PATH_LITERAL("*"));
......
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