Flutter Engine
The Flutter Engine
skia_concurrent_executor.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_RUNTIME_SKIA_CONCURRENT_EXECUTOR_H_
6#define FLUTTER_RUNTIME_SKIA_CONCURRENT_EXECUTOR_H_
7
8#include "flutter/fml/closure.h"
9#include "flutter/fml/macros.h"
11
12namespace flutter {
13
14//------------------------------------------------------------------------------
15/// @brief An interface used by Skia to schedule work on engine managed
16/// threads (usually workers in a concurrent message loop).
17///
18/// Skia may decide that certain workloads don't have thread
19/// affinity and may be performed on a background thread. However,
20/// Skia does not manage its own threads. So, it delegates the
21/// scheduling of this work to the engine via this interface. The
22/// engine has a dedicated pool of threads it uses for scheduling
23/// background tasks that have no thread affinity. This thread
24/// worker pool is held next to the process global Dart VM instance.
25/// The Skia executor is wired up there as well.
26///
28 public:
29 //----------------------------------------------------------------------------
30 /// The callback invoked by the executor to schedule the given task onto an
31 /// engine managed background thread.
32 ///
34
35 //----------------------------------------------------------------------------
36 /// @brief Create a new instance of the executor.
37 ///
38 /// @param[in] on_work The work callback.
39 ///
40 explicit SkiaConcurrentExecutor(const OnWorkCallback& on_work);
41
42 // |SkExecutor|
44
45 // |SkExecutor|
46 void add(fml::closure work) override;
47
48 private:
49 OnWorkCallback on_work_;
50
51 FML_DISALLOW_COPY_AND_ASSIGN(SkiaConcurrentExecutor);
52};
53
54} // namespace flutter
55
56#endif // FLUTTER_RUNTIME_SKIA_CONCURRENT_EXECUTOR_H_
An interface used by Skia to schedule work on engine managed threads (usually workers in a concurrent...
std::function< void(fml::closure work)> OnWorkCallback
void add(fml::closure work) override
SkiaConcurrentExecutor(const OnWorkCallback &on_work)
Create a new instance of the executor.
Dart_NativeFunction function
Definition: fuchsia.cc:51
std::function< void()> closure
Definition: closure.h:14