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

Side by Side Diff: chrome/browser/chromeos/policy/remote_commands/device_commands_factory_chromeos.cc

Issue 2837083002: Use TaskScheduler instead of blocking pool in device_commands_factory_chromeos.cc. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/policy/remote_commands/device_commands_factory _chromeos.h" 5 #include "chrome/browser/chromeos/policy/remote_commands/device_commands_factory _chromeos.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/task_scheduler/post_task.h"
11 #include "chrome/browser/chromeos/policy/remote_commands/device_command_fetch_st atus_job.h" 11 #include "chrome/browser/chromeos/policy/remote_commands/device_command_fetch_st atus_job.h"
12 #include "chrome/browser/chromeos/policy/remote_commands/device_command_reboot_j ob.h" 12 #include "chrome/browser/chromeos/policy/remote_commands/device_command_reboot_j ob.h"
13 #include "chrome/browser/chromeos/policy/remote_commands/device_command_screensh ot_job.h" 13 #include "chrome/browser/chromeos/policy/remote_commands/device_command_screensh ot_job.h"
14 #include "chrome/browser/chromeos/policy/remote_commands/device_command_set_volu me_job.h" 14 #include "chrome/browser/chromeos/policy/remote_commands/device_command_set_volu me_job.h"
15 #include "chrome/browser/chromeos/policy/remote_commands/screenshot_delegate.h" 15 #include "chrome/browser/chromeos/policy/remote_commands/screenshot_delegate.h"
16 #include "chromeos/dbus/dbus_thread_manager.h" 16 #include "chromeos/dbus/dbus_thread_manager.h"
17 #include "components/policy/core/common/remote_commands/remote_command_job.h" 17 #include "components/policy/core/common/remote_commands/remote_command_job.h"
18 #include "components/policy/proto/device_management_backend.pb.h" 18 #include "components/policy/proto/device_management_backend.pb.h"
19 #include "content/public/browser/browser_thread.h"
20 19
21 namespace em = enterprise_management; 20 namespace em = enterprise_management;
22 21
23 namespace policy { 22 namespace policy {
24 23
25 DeviceCommandsFactoryChromeOS::DeviceCommandsFactoryChromeOS() { 24 DeviceCommandsFactoryChromeOS::DeviceCommandsFactoryChromeOS() {
26 } 25 }
27 26
28 DeviceCommandsFactoryChromeOS::~DeviceCommandsFactoryChromeOS() { 27 DeviceCommandsFactoryChromeOS::~DeviceCommandsFactoryChromeOS() {
29 } 28 }
30 29
31 std::unique_ptr<RemoteCommandJob> 30 std::unique_ptr<RemoteCommandJob>
32 DeviceCommandsFactoryChromeOS::BuildJobForType(em::RemoteCommand_Type type) { 31 DeviceCommandsFactoryChromeOS::BuildJobForType(em::RemoteCommand_Type type) {
33 switch (type) { 32 switch (type) {
34 case em::RemoteCommand_Type_DEVICE_REBOOT: 33 case em::RemoteCommand_Type_DEVICE_REBOOT:
35 return base::WrapUnique<RemoteCommandJob>(new DeviceCommandRebootJob( 34 return base::WrapUnique<RemoteCommandJob>(new DeviceCommandRebootJob(
36 chromeos::DBusThreadManager::Get()->GetPowerManagerClient())); 35 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()));
37 case em::RemoteCommand_Type_DEVICE_SCREENSHOT: 36 case em::RemoteCommand_Type_DEVICE_SCREENSHOT:
38 return base::WrapUnique<RemoteCommandJob>( 37 return base::WrapUnique<RemoteCommandJob>(
39 new DeviceCommandScreenshotJob(base::MakeUnique<ScreenshotDelegate>( 38 new DeviceCommandScreenshotJob(base::MakeUnique<ScreenshotDelegate>(
40 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 39 base::CreateSequencedTaskRunnerWithTraits(
41 content::BrowserThread::GetBlockingPool() 40 base::TaskTraits().MayBlock().WithPriority(
42 ->GetSequenceToken())))); 41 base::TaskPriority::BACKGROUND)))));
Thiemo Nagel 2017/04/27 09:48:43 Same here, I think we should SKIP_ON_SHUTDOWN. I
fdoray 2017/04/27 13:27:45 Done.
43 case em::RemoteCommand_Type_DEVICE_SET_VOLUME: 42 case em::RemoteCommand_Type_DEVICE_SET_VOLUME:
44 return base::WrapUnique<RemoteCommandJob>( 43 return base::WrapUnique<RemoteCommandJob>(
45 new DeviceCommandSetVolumeJob()); 44 new DeviceCommandSetVolumeJob());
46 case em::RemoteCommand_Type_DEVICE_FETCH_STATUS: 45 case em::RemoteCommand_Type_DEVICE_FETCH_STATUS:
47 return base::WrapUnique<RemoteCommandJob>( 46 return base::WrapUnique<RemoteCommandJob>(
48 new DeviceCommandFetchStatusJob()); 47 new DeviceCommandFetchStatusJob());
49 default: 48 default:
50 return nullptr; 49 return nullptr;
51 } 50 }
52 } 51 }
53 52
54 } // namespace policy 53 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698