Commit d1e21471 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 /chrome/browser/chromeos/arc.

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

Bug: 874080
Change-Id: I94e3d2a1094235c5b8d2fb3dbb52597df035bb18
Reviewed-on: https://chromium-review.googlesource.com/1191283Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593929}
parent 6c1587f4
......@@ -20,7 +20,7 @@
#include "base/strings/string_util.h"
#include "base/sys_info.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/scoped_blocking_call.h"
#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/chromeos/arc/policy/arc_policy_util.h"
#include "chrome/browser/chromeos/login/demo_mode/demo_session.h"
......@@ -86,7 +86,7 @@ base::LazyInstance<std::set<AccountId>>::DestructorAtExit
// Returns whether ARC can run on the filesystem mounted at |path|.
// This function should run only on threads where IO operations are allowed.
bool IsArcCompatibleFilesystem(const base::FilePath& path) {
base::AssertBlockingAllowed();
base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
// If it can be verified it is not on ecryptfs, then it is ok.
struct statfs statfs_buf;
......
......@@ -11,7 +11,7 @@
#include "base/files/file.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/scoped_blocking_call.h"
#include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_util.h"
#include "content/public/browser/browser_thread.h"
#include "mojo/public/cpp/platform/platform_handle.h"
......@@ -32,7 +32,7 @@ int ReadFile(base::File* file,
// Seeks the file, returns 0 on success, or errno on an error.
int SeekFile(base::File* file, size_t offset) {
base::AssertBlockingAllowed();
base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
// lseek() instead of |file|'s method for errno.
off_t result = lseek(file->GetPlatformFile(), offset, SEEK_SET);
return result < 0 ? errno : 0;
......
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