Commit 6fa6aa53 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/shell_integration_win.cc.

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

Bug: 874080
Change-Id: Ifa0f35aa3000ab99401647c45a131b3c457eeb8c
Reviewed-on: https://chromium-review.googlesource.com/1191095
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: default avatarPatrick Monette <pmonette@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594749}
parent 4d4aef3a
......@@ -31,6 +31,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "base/win/registry.h"
......@@ -144,8 +145,6 @@ base::string16 GetExpectedAppId(const base::CommandLine& command_line,
}
void MigrateTaskbarPinsCallback() {
base::AssertBlockingAllowed();
// Get full path of chrome.
base::FilePath chrome_exe;
if (!base::PathService::Get(base::FILE_EXE, &chrome_exe))
......@@ -323,8 +322,6 @@ class OpenSystemSettingsHelper {
// watched. The array must contain at least one element.
static void Begin(const wchar_t* const protocols[],
const base::Closure& on_finished_callback) {
base::AssertBlockingAllowed();
delete instance_;
instance_ = new OpenSystemSettingsHelper(protocols, on_finished_callback);
}
......@@ -527,7 +524,7 @@ void IsPinnedToTaskbarHelper::OnIsPinnedToTaskbarResult(
} // namespace
bool SetAsDefaultBrowser() {
base::AssertBlockingAllowed();
base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
base::FilePath chrome_exe;
if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) {
......@@ -547,7 +544,7 @@ bool SetAsDefaultBrowser() {
}
bool SetAsDefaultProtocolClient(const std::string& protocol) {
base::AssertBlockingAllowed();
base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
if (protocol.empty())
return false;
......@@ -628,7 +625,7 @@ DefaultWebClientState IsDefaultProtocolClient(const std::string& protocol) {
namespace win {
bool SetAsDefaultBrowserUsingIntentPicker() {
base::AssertBlockingAllowed();
base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
base::FilePath chrome_exe;
if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) {
......@@ -647,8 +644,6 @@ bool SetAsDefaultBrowserUsingIntentPicker() {
void SetAsDefaultBrowserUsingSystemSettings(
const base::Closure& on_finished_callback) {
base::AssertBlockingAllowed();
base::FilePath chrome_exe;
if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) {
NOTREACHED() << "Error getting app exe path";
......@@ -673,7 +668,7 @@ void SetAsDefaultBrowserUsingSystemSettings(
}
bool SetAsDefaultProtocolClientUsingIntentPicker(const std::string& protocol) {
base::AssertBlockingAllowed();
base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
base::FilePath chrome_exe;
if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) {
......@@ -695,8 +690,6 @@ bool SetAsDefaultProtocolClientUsingIntentPicker(const std::string& protocol) {
void SetAsDefaultProtocolClientUsingSystemSettings(
const std::string& protocol,
const base::Closure& on_finished_callback) {
base::AssertBlockingAllowed();
base::FilePath chrome_exe;
if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) {
NOTREACHED() << "Error getting app exe path";
......
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