Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1dd1264

Browse files
Jeff Brownabarth
authored andcommitted
[async] Adapt to libasync API changes. (#4980)
1 parent 76cb311 commit 1dd1264

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

‎content_handler/vulkan_surface.cc‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ VulkanSurface::VulkanSurface(vulkan::VulkanProvider& vulkan_provider,
4444

4545
wait_.set_object(release_event_.get());
4646
wait_.set_trigger(ZX_EVENT_SIGNALED);
47-
async_ = async_get_default();
48-
wait_.Begin(async_);
47+
wait_.Begin(async_get_default());
4948

5049
// Probably not necessary as the events should be in the unsignalled state
5150
// already.
@@ -56,11 +55,8 @@ VulkanSurface::VulkanSurface(vulkan::VulkanProvider& vulkan_provider,
5655

5756
VulkanSurface::~VulkanSurface() {
5857
ASSERT_IS_GPU_THREAD;
59-
if (async_) {
60-
wait_.Cancel(async_);
61-
wait_.set_object(ZX_HANDLE_INVALID);
62-
async_ = nullptr;
63-
}
58+
wait_.Cancel();
59+
wait_.set_object(ZX_HANDLE_INVALID);
6460
}
6561

6662
bool VulkanSurface::IsValid() const {
@@ -410,15 +406,16 @@ void VulkanSurface::Reset() {
410406
}
411407
}
412408

413-
async_wait_result_t VulkanSurface::OnHandleReady(async_t* async,
414-
zx_status_t status,
415-
const zx_packet_signal_t* signal) {
409+
void VulkanSurface::OnHandleReady(async_t* async,
410+
async::WaitBase* wait,
411+
zx_status_t status,
412+
const zx_packet_signal_t* signal) {
416413
ASSERT_IS_GPU_THREAD;
417414
if (status != ZX_OK)
418-
return ASYNC_WAIT_FINISHED;
415+
return;
419416
FXL_DCHECK(signal->observed & ZX_EVENT_SIGNALED);
420417
Reset();
421-
return ASYNC_WAIT_AGAIN;
418+
wait->Begin(async);
422419
}
423420

424421
} // namespace flutter_runner

‎content_handler/vulkan_surface.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ class VulkanSurface : public flow::SceneUpdateContext::SurfaceProducerSurface {
7070
}
7171

7272
private:
73-
async_wait_result_t OnHandleReady(async_t* async,
74-
zx_status_t status,
75-
const zx_packet_signal_t* signal);
73+
void OnHandleReady(async_t* async,
74+
async::WaitBase* wait,
75+
zx_status_t status,
76+
const zx_packet_signal_t* signal);
7677

7778
bool AllocateDeviceMemory(sk_sp<GrContext> context,
7879
const SkISize& size,
@@ -106,7 +107,6 @@ class VulkanSurface : public flow::SceneUpdateContext::SurfaceProducerSurface {
106107
vulkan::VulkanHandle<VkSemaphore> acquire_semaphore_;
107108
std::unique_ptr<vulkan::VulkanCommandBuffer> command_buffer_;
108109
zx::event release_event_;
109-
async_t* async_;
110110
async::WaitMethod<VulkanSurface, &VulkanSurface::OnHandleReady> wait_;
111111
std::function<void()> pending_on_writes_committed_;
112112
size_t age_ = 0;

0 commit comments

Comments
 (0)