Skip to content

Commit

Permalink
[TaskScheduler]: Migrate off of AssertBlockingAllowedDeprecated in /p…
Browse files Browse the repository at this point in the history
…rinting

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

Bug: 903957
Change-Id: Ia22660cd032410f40dba9f9f98ccff46d6eaaaf6
Reviewed-on: https://chromium-review.googlesource.com/c/1338488
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609313}
  • Loading branch information
Etienne Pierre-Doray authored and Commit Bot committed Nov 19, 2018
1 parent 45c946c commit 758caee
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions printing/printed_document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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 "printing/metafile.h"
Expand All @@ -47,8 +46,6 @@ base::LazyInstance<base::FilePath>::Leaky g_debug_dump_info =
#if defined(OS_WIN)
void DebugDumpPageTask(const base::string16& doc_name,
const PrintedPage* page) {
base::AssertBlockingAllowedDeprecated();

DCHECK(PrintedDocument::HasDebugDumpPath());

static constexpr base::FilePath::CharType kExtension[] =
Expand All @@ -64,8 +61,6 @@ void DebugDumpPageTask(const base::string16& doc_name,
#else
void DebugDumpTask(const base::string16& doc_name,
const MetafilePlayer* metafile) {
base::AssertBlockingAllowedDeprecated();

DCHECK(PrintedDocument::HasDebugDumpPath());

static constexpr base::FilePath::CharType kExtension[] =
Expand All @@ -82,8 +77,6 @@ void DebugDumpTask(const base::string16& doc_name,
void DebugDumpDataTask(const base::string16& doc_name,
const base::FilePath::StringType& extension,
const base::RefCountedMemory* data) {
base::AssertBlockingAllowedDeprecated();

base::FilePath path =
PrintedDocument::CreateDebugDumpPath(doc_name, extension);
if (path.empty())
Expand Down

0 comments on commit 758caee

Please sign in to comment.