Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stylo compilation on wasm32-unknown-unknown target #78

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
Fix stylo compile on wasm
  • Loading branch information
nicoburns committed Sep 17, 2024
commit c922a90e16040d0fc73a1509a1e992fe0f192afa
16 changes: 16 additions & 0 deletions style/global_style_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ pub type PlatformThreadHandle = RawPthread;
#[cfg(windows)]
pub type PlatformThreadHandle = RawHandle;

/// A noop thread join handle for wasm
#[cfg(target_arch = "wasm32")]
pub struct DummyThreadHandle;
#[cfg(target_arch = "wasm32")]
impl DummyThreadHandle {
/// A noop thread join method for wasm
pub fn join(&self) {
// Do nothing
}
}
#[cfg(target_arch = "wasm32")]
/// Platform-specific handle to a thread.
pub type PlatformThreadHandle = DummyThreadHandle;

/// Global style data
pub struct GlobalStyleData {
/// Shared RWLock for CSSOM objects
Expand Down Expand Up @@ -131,6 +145,8 @@ impl StyleThreadPool {
let handle = join_handle.as_pthread_t();
#[cfg(windows)]
let handle = join_handle.as_raw_handle();
#[cfg(target_arch = "wasm32")]
let handle = DummyThreadHandle;

handles.push(handle);
}
Expand Down