From 9b10989cff70904909cb3d6873a8d6ad943ff186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Sat, 28 Oct 2023 01:30:29 +0200 Subject: [PATCH] core,web: Replace `instant` with `web-time` --- Cargo.lock | 6 +++--- LICENSE.md | 2 +- core/Cargo.toml | 3 +-- core/src/avm1/activation.rs | 2 +- core/src/avm2/globals/flash/utils.rs | 2 +- core/src/backend/audio.rs | 2 +- core/src/context.rs | 2 +- core/src/display_object/interactive.rs | 2 +- core/src/player.rs | 2 +- web/Cargo.toml | 2 +- web/LICENSE.md | 2 +- 11 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7127faf2b968..ff37b9b7a19d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4039,7 +4039,6 @@ dependencies = [ "hashbrown 0.14.2", "image", "indexmap 2.0.2", - "instant", "jpegxr", "linkme", "lzma-rs", @@ -4068,6 +4067,7 @@ dependencies = [ "url", "wasm-bindgen-futures", "weak-table", + "web-time", ] [[package]] @@ -5608,9 +5608,9 @@ dependencies = [ [[package]] name = "web-time" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8208e3fdbc243c8fd30805721869242a7f6de3e2e9f3b057652ab36e52ae1e87" +checksum = "57099a701fb3a8043f993e8228dc24229c7b942e2b009a1b962e54489ba1d3bf" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/LICENSE.md b/LICENSE.md index 368a47551f46..f8f503cf4b4b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -388,7 +388,6 @@ Ruffle depends on third-party libraries with compatible licenses. | [indexmap](https://github.com/bluss/indexmap) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) 2016--2017 | | [indicatif](https://github.com/mitsuhiko/indicatif) | [MIT](#MIT) | Copyright (c) 2017 Armin Ronacher | | [inplace_it](https://github.com/NotIntMan/inplace_it) | [MIT](#MIT) | Copyright (c) 2018 Dmitry Demin | -| [instant](https://github.com/sebcrozet/instant) | [BSD-3-Clause](#BSD-3-Clause) | Copyright (c) 2019, Sébastien Crozet | | [iovec](https://github.com/carllerche/iovec) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) 2017 Carl Lerche | | [isahc](https://github.com/sagebind/isahc) | [MIT](#MIT) | Copyright (c) 2019 Stephen M. Coakley | | [itoa](https://github.com/dtolnay/itoa) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) David Tolnay | @@ -609,6 +608,7 @@ Ruffle depends on third-party libraries with compatible licenses. | [wayland-sys](https://github.com/smithay/wayland-rs) | [MIT](#MIT) | Copyright (c) 2015 Victor Berger | | [weak-table](https://github.com/tov/weak-table-rs) | [MIT](#MIT) | Copyright (c) 2018 Jesse A. Tov | | [web-sys](https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) 2014 Alex Crichton | +| [web-time](https://github.com/daxpedda/web-time) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) 2023 dAxpeDDa | | [webbrowser](https://github.com/amodm/webbrowser-rs) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) 2015 Amod Malviya | | [webpki](https://github.com/briansmith/webpki) | Custom ISC-style | Copyright 2015 Brian Smith. | | [webpki-roots](https://github.com/ctz/webpki-roots) | [MPL-2.0](#MPL-20) | Copyright (c) Joseph Birr-Pixton | diff --git a/core/Cargo.toml b/core/Cargo.toml index db18159adb6c..f1ae2932d906 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -33,7 +33,7 @@ weak-table = "0.3.2" percent-encoding = "2.3.0" thiserror = "1.0" chrono = { version = "0.4", default-features = false, features = ["clock"] } -instant = "0.1" +web-time = "0.2.3" encoding_rs = "0.8.33" rand = { version = "0.8.5", features = ["std", "small_rng"], default-features = false } serde = { version = "1.0.189", features = ["derive"] } @@ -68,7 +68,6 @@ version = "0.4.37" [features] default = [] lzma = ["lzma-rs", "swf/lzma"] -wasm-bindgen = ["instant/wasm-bindgen"] avm_debug = [] deterministic = [] timeline_debug = [] diff --git a/core/src/avm1/activation.rs b/core/src/avm1/activation.rs index ad46f4ed4f37..2f659e72bc32 100644 --- a/core/src/avm1/activation.rs +++ b/core/src/avm1/activation.rs @@ -17,7 +17,6 @@ use crate::vminterface::Instantiator; use crate::{avm_error, avm_warn}; use gc_arena::{Gc, GcCell, Mutation}; use indexmap::IndexMap; -use instant::Instant; use rand::Rng; use smallvec::SmallVec; use std::borrow::Cow; @@ -26,6 +25,7 @@ use std::fmt; use swf::avm1::read::Reader; use swf::avm1::types::*; use url::form_urlencoded; +use web_time::Instant; use super::object_reference::MovieClipReference; diff --git a/core/src/avm2/globals/flash/utils.rs b/core/src/avm2/globals/flash/utils.rs index 7c1d13beafde..c8c8c6c4fab3 100644 --- a/core/src/avm2/globals/flash/utils.rs +++ b/core/src/avm2/globals/flash/utils.rs @@ -5,8 +5,8 @@ use crate::avm2::object::TObject; use crate::avm2::{Activation, Error, Object, Value}; use crate::string::AvmString; use crate::string::WString; -use instant::Instant; use std::fmt::Write; +use web_time::Instant; pub mod byte_array; pub mod dictionary; diff --git a/core/src/backend/audio.rs b/core/src/backend/audio.rs index 0eed123123a6..8e29b6a80389 100644 --- a/core/src/backend/audio.rs +++ b/core/src/backend/audio.rs @@ -32,8 +32,8 @@ mod decoders { } } -use instant::Duration; use thiserror::Error; +use web_time::Duration; pub type SoundHandle = Index; pub type SoundInstanceHandle = Index; diff --git a/core/src/context.rs b/core/src/context.rs index 6a23804149d9..2aba056c36ff 100644 --- a/core/src/context.rs +++ b/core/src/context.rs @@ -28,7 +28,6 @@ use crate::tag_utils::{SwfMovie, SwfSlice}; use crate::timer::Timers; use core::fmt; use gc_arena::{Collect, Mutation}; -use instant::Instant; use rand::rngs::SmallRng; use ruffle_render::backend::{BitmapCacheEntry, RenderBackend}; use ruffle_render::commands::CommandList; @@ -37,6 +36,7 @@ use ruffle_video::backend::VideoBackend; use std::collections::{HashMap, VecDeque}; use std::sync::{Arc, Mutex, Weak}; use std::time::Duration; +use web_time::Instant; /// Minimal context, useful for manipulating the GC heap. pub struct GcContext<'a, 'gc> { diff --git a/core/src/display_object/interactive.rs b/core/src/display_object/interactive.rs index 8d2683964bb6..4c8c108b1c8e 100644 --- a/core/src/display_object/interactive.rs +++ b/core/src/display_object/interactive.rs @@ -17,12 +17,12 @@ use crate::display_object::{ use crate::events::{ClipEvent, ClipEventResult}; use bitflags::bitflags; use gc_arena::{Collect, Mutation}; -use instant::Instant; use ruffle_macros::enum_trait_object; use std::cell::{Ref, RefMut}; use std::fmt::Debug; use std::time::Duration; use swf::{Point, Twips}; +use web_time::Instant; /// Find the lowest common ancestor between the display objects in `from` and /// `to`. diff --git a/core/src/player.rs b/core/src/player.rs index 01affddec899..d285e99f6877 100644 --- a/core/src/player.rs +++ b/core/src/player.rs @@ -49,7 +49,6 @@ use crate::timer::Timers; use crate::vminterface::Instantiator; use crate::DefaultFont; use gc_arena::{Collect, DynamicRootSet, GcCell, Rootable}; -use instant::Instant; use rand::{rngs::SmallRng, SeedableRng}; use ruffle_render::backend::{null::NullRenderer, RenderBackend, ViewportDimensions}; use ruffle_render::commands::CommandList; @@ -64,6 +63,7 @@ use std::str::FromStr; use std::sync::{Arc, Mutex, Weak}; use std::time::Duration; use tracing::{info, instrument}; +use web_time::Instant; /// The newest known Flash Player version, serves as a default to /// `player_version`. diff --git a/web/Cargo.toml b/web/Cargo.toml index 0a643af52c32..5a95bc0355e7 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -56,7 +56,7 @@ gloo-net = { version = "0.4.0", default-features = false, features = ["websocke [dependencies.ruffle_core] path = "../core" -features = ["audio", "mp3", "nellymoser", "wasm-bindgen", "default_compatibility_rules", "default_font"] +features = ["audio", "mp3", "nellymoser", "default_compatibility_rules", "default_font"] [dependencies.web-sys] version = "0.3.64" diff --git a/web/LICENSE.md b/web/LICENSE.md index f990238ff3fd..8af4c898f8e7 100644 --- a/web/LICENSE.md +++ b/web/LICENSE.md @@ -388,7 +388,6 @@ Ruffle depends on third-party libraries with compatible licenses. | [indexmap](https://github.com/bluss/indexmap) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) 2016--2017 | | [indicatif](https://github.com/mitsuhiko/indicatif) | [MIT](#MIT) | Copyright (c) 2017 Armin Ronacher | | [inplace_it](https://github.com/NotIntMan/inplace_it) | [MIT](#MIT) | Copyright (c) 2018 Dmitry Demin | -| [instant](https://github.com/sebcrozet/instant) | [BSD-3-Clause](#BSD-3-Clause) | Copyright (c) 2019, Sébastien Crozet | | [iovec](https://github.com/carllerche/iovec) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) 2017 Carl Lerche | | [isahc](https://github.com/sagebind/isahc) | [MIT](#MIT) | Copyright (c) 2019 Stephen M. Coakley | | [itoa](https://github.com/dtolnay/itoa) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) David Tolnay | @@ -607,6 +606,7 @@ Ruffle depends on third-party libraries with compatible licenses. | [wayland-sys](https://github.com/smithay/wayland-rs) | [MIT](#MIT) | Copyright (c) 2015 Victor Berger | | [weak-table](https://github.com/tov/weak-table-rs) | [MIT](#MIT) | Copyright (c) 2018 Jesse A. Tov | | [web-sys](https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) 2014 Alex Crichton | +| [web-time](https://github.com/daxpedda/web-time) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) 2023 dAxpeDDa | | [webbrowser](https://github.com/amodm/webbrowser-rs) | [Apache-2.0](#Apache-20)/[MIT](#MIT) | Copyright (c) 2015 Amod Malviya | | [webpki](https://github.com/briansmith/webpki) | Custom ISC-style | Copyright 2015 Brian Smith. | | [webpki-roots](https://github.com/ctz/webpki-roots) | [MPL-2.0](#MPL-20) | Copyright (c) Joseph Birr-Pixton |