Skip to content

Commit 689dc97

Browse files
committed
Move INVALID_POLLABLE_HANDLE into the api namespace
1 parent f7e2745 commit 689dc97

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

builtins/web/timers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class TimerTask final : public api::AsyncTask {
7777
}
7878

7979
// The task might've been canceled during the callback.
80-
if (handle_ != INVALID_POLLABLE_HANDLE) {
80+
if (handle_ != api::INVALID_POLLABLE_HANDLE) {
8181
host_api::MonotonicClock::unsubscribe(handle_);
8282
}
8383

host-apis/wasi-0.2.0/host_api.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class IncomingBodyHandle final : public WASIHandle<host_api::HttpIncomingBody> {
213213

214214
public:
215215
explicit IncomingBodyHandle(HandleOps<host_api::HttpIncomingBody>::owned handle)
216-
: WASIHandle(handle), pollable_handle_(INVALID_POLLABLE_HANDLE) {
216+
: WASIHandle(handle), pollable_handle_(api::INVALID_POLLABLE_HANDLE) {
217217
HandleOps<InputStream>::owned stream{};
218218
if (!wasi_http_0_2_0_types_method_incoming_body_stream(borrow(), &stream)) {
219219
MOZ_ASSERT_UNREACHABLE("Getting a body's stream should never fail");
@@ -234,7 +234,7 @@ class OutgoingBodyHandle final : public WASIHandle<host_api::HttpOutgoingBody> {
234234

235235
public:
236236
explicit OutgoingBodyHandle(HandleOps<host_api::HttpOutgoingBody>::owned handle)
237-
: WASIHandle(handle), pollable_handle_(INVALID_POLLABLE_HANDLE) {
237+
: WASIHandle(handle), pollable_handle_(api::INVALID_POLLABLE_HANDLE) {
238238
HandleOps<OutputStream>::owned stream{};
239239
if (!wasi_http_0_2_0_types_method_outgoing_body_write(borrow(), &stream)) {
240240
MOZ_ASSERT_UNREACHABLE("Getting a body's stream should never fail");
@@ -837,7 +837,7 @@ Result<Void> HttpOutgoingBody::close() {
837837
}
838838
}
839839

840-
if (state->pollable_handle_ != INVALID_POLLABLE_HANDLE) {
840+
if (state->pollable_handle_ != api::INVALID_POLLABLE_HANDLE) {
841841
wasi_io_0_2_0_poll_pollable_drop_own(own_pollable_t{state->pollable_handle_});
842842
}
843843
wasi_io_0_2_0_streams_output_stream_drop_own({state->stream_handle_});
@@ -852,7 +852,7 @@ Result<Void> HttpOutgoingBody::close() {
852852
}
853853
Result<PollableHandle> HttpOutgoingBody::subscribe() {
854854
auto state = static_cast<OutgoingBodyHandle *>(handle_state_.get());
855-
if (state->pollable_handle_ == INVALID_POLLABLE_HANDLE) {
855+
if (state->pollable_handle_ == api::INVALID_POLLABLE_HANDLE) {
856856
Borrow<OutputStream> borrow(state->stream_handle_);
857857
state->pollable_handle_ = wasi_io_0_2_0_streams_method_output_stream_subscribe(borrow).__handle;
858858
}
@@ -861,11 +861,11 @@ Result<PollableHandle> HttpOutgoingBody::subscribe() {
861861

862862
void HttpOutgoingBody::unsubscribe() {
863863
auto state = static_cast<OutgoingBodyHandle *>(handle_state_.get());
864-
if (state->pollable_handle_ == INVALID_POLLABLE_HANDLE) {
864+
if (state->pollable_handle_ == api::INVALID_POLLABLE_HANDLE) {
865865
return;
866866
}
867867
wasi_io_0_2_0_poll_pollable_drop_own(own_pollable_t{state->pollable_handle_});
868-
state->pollable_handle_ = INVALID_POLLABLE_HANDLE;
868+
state->pollable_handle_ = api::INVALID_POLLABLE_HANDLE;
869869
}
870870

871871
static const char *http_method_names[9] = {"GET", "HEAD", "POST", "PUT", "DELETE",
@@ -1039,11 +1039,11 @@ Result<PollableHandle> HttpIncomingBody::subscribe() {
10391039
}
10401040
void HttpIncomingBody::unsubscribe() {
10411041
auto state = static_cast<IncomingBodyHandle *>(handle_state_.get());
1042-
if (state->pollable_handle_ == INVALID_POLLABLE_HANDLE) {
1042+
if (state->pollable_handle_ == api::INVALID_POLLABLE_HANDLE) {
10431043
return;
10441044
}
10451045
wasi_io_0_2_0_poll_pollable_drop_own(own_pollable_t{state->pollable_handle_});
1046-
state->pollable_handle_ = INVALID_POLLABLE_HANDLE;
1046+
state->pollable_handle_ = api::INVALID_POLLABLE_HANDLE;
10471047
}
10481048

10491049
FutureHttpIncomingResponse::FutureHttpIncomingResponse(std::unique_ptr<HandleState> state) {

include/extension-api.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ using JS::MutableHandleValue;
2424
using JS::PersistentRooted;
2525
using JS::PersistentRootedVector;
2626

27+
namespace api {
28+
2729
typedef int32_t PollableHandle;
2830
constexpr PollableHandle INVALID_POLLABLE_HANDLE = -1;
2931

30-
namespace api {
31-
3232
class AsyncTask;
3333

3434
class Engine {

0 commit comments

Comments
 (0)