Commit 1b4dd201 authored by Etienne Pierre-Doray's avatar Etienne Pierre-Doray Committed by Commit Bot

[TaskScheduler]: Migrate off of AssertBlockingAllowedDeprecated in /ui/ozone/platform/drm

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

Bug: 903957
Change-Id: Ie052b76a8c8c4083857f9deb5d46eb03e1cb15e6
Reviewed-on: https://chromium-review.googlesource.com/c/1338482
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613139}
parent 7897e08e
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/posix/eintr_wrapper.h" #include "base/posix/eintr_wrapper.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/scoped_blocking_call.h"
#include "base/time/time.h" #include "base/time/time.h"
namespace ui { namespace ui {
...@@ -38,8 +38,11 @@ DrmDeviceHandle::DrmDeviceHandle() { ...@@ -38,8 +38,11 @@ DrmDeviceHandle::DrmDeviceHandle() {
} }
DrmDeviceHandle::~DrmDeviceHandle() { DrmDeviceHandle::~DrmDeviceHandle() {
if (file_.is_valid()) if (file_.is_valid()) {
base::AssertBlockingAllowedDeprecated(); base::ScopedBlockingCall scoped_blocking_call(
base::BlockingType::MAY_BLOCK);
file_.reset();
}
} }
bool DrmDeviceHandle::Initialize(const base::FilePath& dev_path, bool DrmDeviceHandle::Initialize(const base::FilePath& dev_path,
...@@ -48,7 +51,7 @@ bool DrmDeviceHandle::Initialize(const base::FilePath& dev_path, ...@@ -48,7 +51,7 @@ bool DrmDeviceHandle::Initialize(const base::FilePath& dev_path,
// expected path, so use a CHECK instead of a DCHECK. The sys_path is only // expected path, so use a CHECK instead of a DCHECK. The sys_path is only
// used a label and is otherwise unvalidated. // used a label and is otherwise unvalidated.
CHECK(dev_path.DirName() == base::FilePath("/dev/dri")); CHECK(dev_path.DirName() == base::FilePath("/dev/dri"));
base::AssertBlockingAllowedDeprecated(); base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
int num_auth_attempts = 0; int num_auth_attempts = 0;
bool logged_warning = false; bool logged_warning = false;
......
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