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

Side by Side Diff: content/browser/font_list_async.cc

Issue 2886883003: Remove content::kFontListSequenceToken. (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 | content/browser/renderer_host/pepper/pepper_browser_font_singleton_host.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/public/browser/font_list_async.h" 5 #include "content/public/browser/font_list_async.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/task_runner_util.h"
10 #include "base/values.h" 11 #include "base/values.h"
11 #include "content/common/font_list.h" 12 #include "content/common/font_list.h"
12 #include "content/public/browser/browser_thread.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 namespace {
17
18 // Just executes the given callback with the parameter.
19 void ReturnFontListToOriginalThread(
20 const base::Callback<void(std::unique_ptr<base::ListValue>)>& callback,
21 std::unique_ptr<base::ListValue> result) {
22 callback.Run(std::move(result));
23 }
24
25 void GetFontListInBlockingPool(
26 BrowserThread::ID calling_thread_id,
27 const base::Callback<void(std::unique_ptr<base::ListValue>)>& callback) {
28 std::unique_ptr<base::ListValue> result(GetFontList_SlowBlocking());
29 BrowserThread::PostTask(calling_thread_id, FROM_HERE,
30 base::Bind(&ReturnFontListToOriginalThread, callback,
31 base::Passed(&result)));
32 }
33
34 } // namespace
35
36 void GetFontListAsync( 16 void GetFontListAsync(
37 const base::Callback<void(std::unique_ptr<base::ListValue>)>& callback) { 17 base::OnceCallback<void(std::unique_ptr<base::ListValue>)> callback) {
38 BrowserThread::ID id; 18 base::PostTaskAndReplyWithResult(GetFontListTaskRunner().get(), FROM_HERE,
39 bool well_known_thread = BrowserThread::GetCurrentThreadIdentifier(&id); 19 base::BindOnce(&GetFontList_SlowBlocking),
40 DCHECK(well_known_thread) 20 std::move(callback));
41 << "Can only call GetFontList from a well-known thread.";
42
43 BrowserThread::PostBlockingPoolSequencedTask(
44 kFontListSequenceToken,
45 FROM_HERE,
46 base::Bind(&GetFontListInBlockingPool, id, callback));
47 } 21 }
48 22
49 } // namespace content 23 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/pepper/pepper_browser_font_singleton_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698