Skia
2DGraphicsLibrary
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
SkExecutor.h
1
/*
2
* Copyright 2017 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#ifndef SkExecutor_DEFINED
9
#define SkExecutor_DEFINED
10
11
#include <functional>
12
#include <memory>
13
14
class
SkExecutor
{
15
public
:
16
virtual
~
SkExecutor
();
17
18
// Create a thread pool SkExecutor with a fixed thread count, by default the number of cores.
19
static
std::unique_ptr<SkExecutor> MakeThreadPool(
int
threads = 0);
20
21
// There is always a default SkExecutor available by calling SkExecutor::GetDefault().
22
static
SkExecutor
& GetDefault();
23
static
void
SetDefault(
SkExecutor
*);
// Does not take ownership. Not thread safe.
24
25
// Add work to execute.
26
virtual
void
add(std::function<
void
(
void
)>) = 0;
27
28
// If it makes sense for this executor, use this thread to execute work for a little while.
29
virtual
void
borrow() {}
30
};
31
32
#endif//SkExecutor_DEFINED
SkExecutor
Definition:
SkExecutor.h:14