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

Side by Side Diff: components/webcrypto/webcrypto_impl.cc

Issue 2077413009: Add TaskPriority as a parameter to SequencedWorkerPool in preparation for TaskScheduler experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2_hook
Patch Set: tweak comment Created 4 years, 5 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 | « chrome/service/service_process.cc ('k') | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/webcrypto/webcrypto_impl.h" 5 #include "components/webcrypto/webcrypto_impl.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // 65 //
66 // * blink::WebCryptoResult is not threadsafe and should only be operated on 66 // * blink::WebCryptoResult is not threadsafe and should only be operated on
67 // the target Blink thread. HOWEVER, it is safe to delete it from any thread. 67 // the target Blink thread. HOWEVER, it is safe to delete it from any thread.
68 // This can happen if by the time the operation has completed in the crypto 68 // This can happen if by the time the operation has completed in the crypto
69 // worker pool, the Blink worker thread that initiated the request is gone. 69 // worker pool, the Blink worker thread that initiated the request is gone.
70 // Posting back to the origin thread will fail, and the WebCryptoResult will 70 // Posting back to the origin thread will fail, and the WebCryptoResult will
71 // be deleted while running in the crypto worker pool. 71 // be deleted while running in the crypto worker pool.
72 class CryptoThreadPool { 72 class CryptoThreadPool {
73 public: 73 public:
74 CryptoThreadPool() 74 CryptoThreadPool()
75 : worker_pool_(new base::SequencedWorkerPool(1, "WebCrypto")), 75 : worker_pool_(
76 new base::SequencedWorkerPool(1,
77 "WebCrypto",
78 base::TaskPriority::USER_BLOCKING)),
76 task_runner_(worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( 79 task_runner_(worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior(
77 worker_pool_->GetSequenceToken(), 80 worker_pool_->GetSequenceToken(),
78 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)) {} 81 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)) {}
79 82
80 static bool PostTask(const tracked_objects::Location& from_here, 83 static bool PostTask(const tracked_objects::Location& from_here,
81 const base::Closure& task); 84 const base::Closure& task);
82 85
83 private: 86 private:
84 scoped_refptr<base::SequencedWorkerPool> worker_pool_; 87 scoped_refptr<base::SequencedWorkerPool> worker_pool_;
85 scoped_refptr<base::SequencedTaskRunner> task_runner_; 88 scoped_refptr<base::SequencedTaskRunner> task_runner_;
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 webcrypto::CryptoData(key_data, key_data_size), &key); 784 webcrypto::CryptoData(key_data, key_data_size), &key);
782 } 785 }
783 786
784 bool WebCryptoImpl::serializeKeyForClone( 787 bool WebCryptoImpl::serializeKeyForClone(
785 const blink::WebCryptoKey& key, 788 const blink::WebCryptoKey& key,
786 blink::WebVector<unsigned char>& key_data) { 789 blink::WebVector<unsigned char>& key_data) {
787 return webcrypto::SerializeKeyForClone(key, &key_data); 790 return webcrypto::SerializeKeyForClone(key, &key_data);
788 } 791 }
789 792
790 } // namespace webcrypto 793 } // namespace webcrypto
OLDNEW
« no previous file with comments | « chrome/service/service_process.cc ('k') | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698