Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
rename to NoExceptionPromise
  • Loading branch information
jason-simmons committed Feb 23, 2024
commit d25e0b61abb0cfb795193eb8c67102b3fb15c634
8 changes: 4 additions & 4 deletions impeller/base/base_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ TEST(ConditionVariableTest, TestsCriticalSectionAfterWait) {
ASSERT_EQ(sum, kThreadCount);
}

TEST(BaseTest, PromiseDestructWrapperValue) {
PromiseDestructWrapper<int> wrapper;
TEST(BaseTest, NoExceptionPromiseValue) {
NoExceptionPromise<int> wrapper;
std::future future = wrapper.get_future();
wrapper.set_value(123);
ASSERT_EQ(future.get(), 123);
}

TEST(BaseTest, PromiseDestructWrapperEmpty) {
auto wrapper = std::make_shared<PromiseDestructWrapper<int>>();
TEST(BaseTest, NoExceptionPromiseEmpty) {
auto wrapper = std::make_shared<NoExceptionPromise<int>>();
std::future future = wrapper->get_future();

// Destroy the empty promise with the future still pending. Verify that the
Expand Down
6 changes: 3 additions & 3 deletions impeller/base/promise.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ std::future<T> RealizedFuture(T t) {
// By default the std::promise destructor will complete an empty promise with an
// exception. This will fail because Flutter is built without exception support.
template <typename T>
class PromiseDestructWrapper {
class NoExceptionPromise {
public:
PromiseDestructWrapper() = default;
NoExceptionPromise() = default;

~PromiseDestructWrapper() {
~NoExceptionPromise() {
if (!value_set_) {
promise_.set_value({});
}
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/vulkan/pipeline_library_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ PipelineFuture<PipelineDescriptor> PipelineLibraryVK::GetPipeline(
}

auto promise = std::make_shared<
PromiseDestructWrapper<std::shared_ptr<Pipeline<PipelineDescriptor>>>>();
NoExceptionPromise<std::shared_ptr<Pipeline<PipelineDescriptor>>>>();
auto pipeline_future =
PipelineFuture<PipelineDescriptor>{descriptor, promise->get_future()};
pipelines_[descriptor] = pipeline_future;
Expand Down