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

Side by Side Diff: chrome/browser/chromeos/settings/session_manager_operation.cc

Issue 2836133002: Use TaskScheduler instead of blocking pool in session_manager_operation.cc. (Closed)
Patch Set: Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/settings/session_manager_operation.h" 5 #include "chrome/browser/chromeos/settings/session_manager_operation.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/task_runner_util.h" 15 #include "base/task_runner_util.h"
16 #include "base/task_scheduler/post_task.h"
16 #include "base/threading/sequenced_worker_pool.h" 17 #include "base/threading/sequenced_worker_pool.h"
17 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" 18 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
18 #include "chrome/browser/net/nss_context.h" 19 #include "chrome/browser/net/nss_context.h"
19 #include "components/ownership/owner_key_util.h" 20 #include "components/ownership/owner_key_util.h"
20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 21 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
21 #include "components/policy/proto/device_management_backend.pb.h" 22 #include "components/policy/proto/device_management_backend.pb.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 #include "crypto/rsa_private_key.h" 24 #include "crypto/rsa_private_key.h"
24 #include "crypto/signature_creator.h" 25 #include "crypto/signature_creator.h"
25 26
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 80 }
80 81
81 void SessionManagerOperation::ReportResult( 82 void SessionManagerOperation::ReportResult(
82 DeviceSettingsService::Status status) { 83 DeviceSettingsService::Status status) {
83 callback_.Run(this, status); 84 callback_.Run(this, status);
84 } 85 }
85 86
86 void SessionManagerOperation::EnsurePublicKey(const base::Closure& callback) { 87 void SessionManagerOperation::EnsurePublicKey(const base::Closure& callback) {
87 if (force_key_load_ || !public_key_ || !public_key_->is_loaded()) { 88 if (force_key_load_ || !public_key_ || !public_key_->is_loaded()) {
88 scoped_refptr<base::TaskRunner> task_runner = 89 scoped_refptr<base::TaskRunner> task_runner =
89 content::BrowserThread::GetBlockingPool() 90 base::CreateTaskRunnerWithTraits(
90 ->GetTaskRunnerWithShutdownBehavior( 91 base::TaskTraits()
91 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); 92 .MayBlock()
93 .WithPriority(base::TaskPriority::BACKGROUND)
94 .WithShutdownBehavior(
95 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN));
92 base::PostTaskAndReplyWithResult( 96 base::PostTaskAndReplyWithResult(
93 task_runner.get(), FROM_HERE, 97 task_runner.get(), FROM_HERE,
94 base::Bind(&SessionManagerOperation::LoadPublicKey, owner_key_util_, 98 base::Bind(&SessionManagerOperation::LoadPublicKey, owner_key_util_,
95 force_key_load_ ? nullptr : public_key_), 99 force_key_load_ ? nullptr : public_key_),
96 base::Bind(&SessionManagerOperation::StorePublicKey, 100 base::Bind(&SessionManagerOperation::StorePublicKey,
97 weak_factory_.GetWeakPtr(), callback)); 101 weak_factory_.GetWeakPtr(), callback));
98 } else { 102 } else {
99 callback.Run(); 103 callback.Run();
100 } 104 }
101 } 105 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 266 }
263 267
264 void StoreSettingsOperation::HandleStoreResult(bool success) { 268 void StoreSettingsOperation::HandleStoreResult(bool success) {
265 if (!success) 269 if (!success)
266 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); 270 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED);
267 else 271 else
268 StartLoading(); 272 StartLoading();
269 } 273 }
270 274
271 } // namespace chromeos 275 } // namespace chromeos
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