Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: chrome/browser/printing/printer_manager_dialog_linux.cc

Issue 2965803002: Move more printing code off of the FILE thread. (Closed)
Patch Set: tweak Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/printing/printer_manager_dialog_linux.cc
diff --git a/chrome/browser/printing/printer_manager_dialog_linux.cc b/chrome/browser/printing/printer_manager_dialog_linux.cc
index 156dda953d3779a70fe6bd5a6d6a733a682f966b..43736f963311359dc44af2ed075dbed092c2cf17 100644
--- a/chrome/browser/printing/printer_manager_dialog_linux.cc
+++ b/chrome/browser/printing/printer_manager_dialog_linux.cc
@@ -9,15 +9,11 @@
#include "base/bind.h"
#include "base/environment.h"
#include "base/files/file_util.h"
-#include "base/message_loop/message_loop.h"
#include "base/nix/xdg_util.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
-#include "base/strings/string_split.h"
-#include "content/public/browser/browser_thread.h"
-
-using base::Environment;
-using content::BrowserThread;
+#include "base/task_scheduler/post_task.h"
+#include "base/threading/thread_restrictions.h"
namespace {
@@ -49,8 +45,8 @@ bool OpenPrinterConfigDialog(const char* const* command) {
// Detect the command based on the deskop environment and open the printer
// manager dialog.
void DetectAndOpenPrinterConfigDialog() {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
- std::unique_ptr<Environment> env(Environment::Create());
+ base::ThreadRestrictions::AssertIOAllowed();
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
bool opened = false;
switch (base::nix::GetDesktopEnvironment(env.get())) {
@@ -73,13 +69,14 @@ void DetectAndOpenPrinterConfigDialog() {
LOG_IF(ERROR, !opened) << "Failed to open printer manager dialog ";
}
-} // anonymous namespace
+} // namespace
namespace printing {
void PrinterManagerDialog::ShowPrinterManagerDialog() {
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
- base::BindOnce(&DetectAndOpenPrinterConfigDialog));
+ base::PostTaskWithTraits(
+ FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING},
+ base::BindOnce(&DetectAndOpenPrinterConfigDialog));
}
} // namespace printing
« no previous file with comments | « chrome/browser/printing/print_dialog_cloud_win.cc ('k') | chrome/browser/printing/printer_manager_dialog_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698