Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
gpu
ganesh
gl
GrGLFinishCallbacks.cpp
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
#include "
src/gpu/ganesh/gl/GrGLFinishCallbacks.h
"
9
#include "
src/gpu/ganesh/gl/GrGLGpu.h
"
10
11
GrGLFinishCallbacks::GrGLFinishCallbacks
(
GrGLGpu
* gpu) : fGpu(gpu) {}
12
13
GrGLFinishCallbacks::~GrGLFinishCallbacks
() {
14
this->
callAll
(
true
);
15
}
16
17
void
GrGLFinishCallbacks::add
(
GrGpuFinishedProc
finishedProc,
18
GrGpuFinishedContext
finishedContext) {
19
SkASSERT
(finishedProc);
20
FinishCallback
callback
;
21
callback
.fCallback = finishedProc;
22
callback
.fContext = finishedContext;
23
callback
.fFence = fGpu->
insertFence
();
24
fCallbacks.push_back(
callback
);
25
}
26
27
void
GrGLFinishCallbacks::check
() {
28
// Bail after the first unfinished sync since we expect they signal in the order inserted.
29
while
(!fCallbacks.empty() && fGpu->
waitFence
(fCallbacks.front().fFence)) {
30
// While we are processing a proc we need to make sure to remove it from the callback list
31
// before calling it. This is because the client could trigger a call (e.g. calling
32
// flushAndSubmit(/*sync=*/true)) that has us process the finished callbacks. We also must
33
// process deleting the fence before a client may abandon the context.
34
auto
finishCallback = fCallbacks.front();
35
fGpu->
deleteFence
(finishCallback.fFence);
36
fCallbacks.pop_front();
37
finishCallback.fCallback(finishCallback.fContext);
38
}
39
}
40
41
void
GrGLFinishCallbacks::callAll
(
bool
doDelete) {
42
while
(!fCallbacks.empty()) {
43
// While we are processing a proc we need to make sure to remove it from the callback list
44
// before calling it. This is because the client could trigger a call (e.g. calling
45
// flushAndSubmit(/*sync=*/true)) that has us process the finished callbacks. We also must
46
// process deleting the fence before a client may abandon the context.
47
auto
finishCallback = fCallbacks.front();
48
if
(doDelete) {
49
fGpu->
deleteFence
(finishCallback.fFence);
50
}
51
fCallbacks.pop_front();
52
finishCallback.fCallback(finishCallback.fContext);
53
}
54
}
GrGLFinishCallbacks.h
GrGLGpu.h
GrGpuFinishedContext
void * GrGpuFinishedContext
Definition
GrTypes.h:178
GrGpuFinishedProc
void(* GrGpuFinishedProc)(GrGpuFinishedContext finishedContext)
Definition
GrTypes.h:179
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
GrGLFinishCallbacks::add
void add(GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)
Definition
GrGLFinishCallbacks.cpp:17
GrGLFinishCallbacks::check
void check()
Definition
GrGLFinishCallbacks.cpp:27
GrGLFinishCallbacks::GrGLFinishCallbacks
GrGLFinishCallbacks(GrGLGpu *gpu)
Definition
GrGLFinishCallbacks.cpp:11
GrGLFinishCallbacks::~GrGLFinishCallbacks
~GrGLFinishCallbacks()
Definition
GrGLFinishCallbacks.cpp:13
GrGLFinishCallbacks::callAll
void callAll(bool doDelete)
Definition
GrGLFinishCallbacks.cpp:41
GrGLGpu
Definition
GrGLGpu.h:89
GrGLGpu::insertFence
GrGLsync insertFence()
Definition
GrGLGpu.cpp:4286
GrGLGpu::deleteFence
void deleteFence(GrGLsync)
Definition
GrGLGpu.cpp:4335
GrGLGpu::waitFence
bool waitFence(GrGLsync)
Definition
GrGLGpu.cpp:4328
callback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Definition
fl_key_channel_responder.cc:120
Generated on Fri Apr 26 2024 06:17:00 for Flutter Engine by
1.9.8