Flutter Engine
The Flutter Engine
GrGLFinishCallbacks.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC.
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 GrGLFinishCallbacks_DEFINED
9#define GrGLFinishCallbacks_DEFINED
10
11#include "include/gpu/GrTypes.h"
13
14#include <list>
15
16class GrGLGpu;
17
18/**
19 * Maintains a list of callbacks to be called when work on the GPU is complete.
20 */
21
23public:
26
27 /**
28 * Call all the callbacks in the list. This will block until all work is done.
29 *
30 * @param doDelete delete the contained fence object.
31 */
32 void callAll(bool doDelete);
33
34 /**
35 * Add a new callback to the list.
36 *
37 * @param finishedProc The function to call when GPU work is complete.
38 * @param finishedContext The context object to pass back to the callback.
39 */
40 void add(GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext);
41
42 /**
43 * Check if any GPU work is complete, and call the associated callbacks.
44 * This call is non-blocking.
45 */
46 void check();
47
48 /**
49 * Returns true if the callback list is empty.
50 */
51 bool empty() const { return fCallbacks.empty(); }
52
53private:
54 struct FinishCallback {
55 GrGpuFinishedProc fCallback;
57 GrGLsync fFence;
58 };
59
60 GrGLGpu* fGpu;
61 std::list<FinishCallback> fCallbacks;
62};
63
64#endif // GrGLFinishCallbacks
struct __GLsync * GrGLsync
Definition: GrGLTypes.h:129
void * GrGpuFinishedContext
Definition: GrTypes.h:178
void(* GrGpuFinishedProc)(GrGpuFinishedContext finishedContext)
Definition: GrTypes.h:179
const Context & fContext
void add(GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)
GrGLFinishCallbacks(GrGLGpu *gpu)
void callAll(bool doDelete)