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

Side by Side Diff: chrome/browser/net/nss_context.cc

Issue 1121213002: [chrome/browser/net] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Review Comments Created 5 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 | chrome/browser/net/quota_policy_channel_id_store_unittest.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 "chrome/browser/net/nss_context.h" 5 #include "chrome/browser/net/nss_context.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/sequenced_task_runner.h"
8 #include "base/single_thread_task_runner.h"
9 #include "base/thread_task_runner_handle.h"
8 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
9 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/resource_context.h" 12 #include "content/public/browser/resource_context.h"
11 13
12 using content::BrowserThread; 14 using content::BrowserThread;
13 15
14 namespace { 16 namespace {
15 17
16 // Relays callback to the right message loop. 18 // Relays callback to the right message loop.
17 void DidGetCertDBOnIOThread( 19 void DidGetCertDBOnIOThread(
18 scoped_refptr<base::MessageLoopProxy> response_message_loop, 20 const scoped_refptr<base::SequencedTaskRunner>& response_task_runner,
19 const base::Callback<void(net::NSSCertDatabase*)>& callback, 21 const base::Callback<void(net::NSSCertDatabase*)>& callback,
20 net::NSSCertDatabase* cert_db) { 22 net::NSSCertDatabase* cert_db) {
21 DCHECK_CURRENTLY_ON(BrowserThread::IO); 23 DCHECK_CURRENTLY_ON(BrowserThread::IO);
22 24
23 response_message_loop->PostTask(FROM_HERE, base::Bind(callback, cert_db)); 25 response_task_runner->PostTask(FROM_HERE, base::Bind(callback, cert_db));
24 } 26 }
25 27
26 // Gets NSSCertDatabase for the resource context. 28 // Gets NSSCertDatabase for the resource context.
27 void GetCertDBOnIOThread( 29 void GetCertDBOnIOThread(
28 content::ResourceContext* context, 30 content::ResourceContext* context,
29 scoped_refptr<base::MessageLoopProxy> response_message_loop, 31 const scoped_refptr<base::SequencedTaskRunner>& response_task_runner,
30 const base::Callback<void(net::NSSCertDatabase*)>& callback) { 32 const base::Callback<void(net::NSSCertDatabase*)>& callback) {
31 DCHECK_CURRENTLY_ON(BrowserThread::IO); 33 DCHECK_CURRENTLY_ON(BrowserThread::IO);
32 34
33 // Note that the callback will be used only if the cert database hasn't yet 35 // Note that the callback will be used only if the cert database hasn't yet
34 // been initialized. 36 // been initialized.
35 net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext( 37 net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext(
36 context, 38 context,
37 base::Bind(&DidGetCertDBOnIOThread, response_message_loop, callback)); 39 base::Bind(&DidGetCertDBOnIOThread, response_task_runner, callback));
38 40
39 if (cert_db) 41 if (cert_db)
40 DidGetCertDBOnIOThread(response_message_loop, callback, cert_db); 42 DidGetCertDBOnIOThread(response_task_runner, callback, cert_db);
41 } 43 }
42 44
43 } // namespace 45 } // namespace
44 46
45 void GetNSSCertDatabaseForProfile( 47 void GetNSSCertDatabaseForProfile(
46 Profile* profile, 48 Profile* profile,
47 const base::Callback<void(net::NSSCertDatabase*)>& callback) { 49 const base::Callback<void(net::NSSCertDatabase*)>& callback) {
48 DCHECK_CURRENTLY_ON(BrowserThread::UI); 50 DCHECK_CURRENTLY_ON(BrowserThread::UI);
49 51
50 BrowserThread::PostTask(BrowserThread::IO, 52 BrowserThread::PostTask(BrowserThread::IO,
51 FROM_HERE, 53 FROM_HERE,
52 base::Bind(&GetCertDBOnIOThread, 54 base::Bind(&GetCertDBOnIOThread,
53 profile->GetResourceContext(), 55 profile->GetResourceContext(),
54 base::MessageLoopProxy::current(), 56 base::ThreadTaskRunnerHandle::Get(),
55 callback)); 57 callback));
56 } 58 }
57 59
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/quota_policy_channel_id_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698