Upgrade to new `gc-arena` API (#11182)
* core: add temporary, ruffle-internal copy of `gc-arena` crate This will allow bumping the upstream `gc-arena` version while reexporting our own version of the old `GcCell` API, so that Ruffle's code can be gradually migrated. Once the migration is done, this crate should be removed. * core: bump `gc-arena` to kyren/gc-arena#56 Add back the removed `GcCell` to our internal facade crate * core: bump `gc-arena` to current master This bump renames `Gc::allocate` to `Gc::new` * core: rename `GcCell::allocate` to `GcCell::new`, to match `Gc` * core: bump gc-arena to (slighly after) v0.3.1 Add typedefs for old `*Context` names in the gc-arena facade crate * core: replace uses of `CollectionContext<'_>` by `&Collection` * core: Add `gc()` convenience method for `*Context` and `Activation` types This allows shortening most instances of `[activation.]context.gc_context` to `activation.gc()` or `context.gc()` (but not all instances, because of borrowck) Note that this doesn't actually do these shortenings to avoid major code churn.
This commit is contained in:
parent
9d3e96e3a4
commit
f5b4fbce77
|
@ -1810,8 +1810,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gc-arena"
|
||||
version = "0.2.2"
|
||||
source = "git+https://github.com/kyren/gc-arena?rev=63dab12871321e0e5ada10ff1f1de8f4cf1764f9#63dab12871321e0e5ada10ff1f1de8f4cf1764f9"
|
||||
version = "0.3.1"
|
||||
source = "git+https://github.com/kyren/gc-arena?rev=ad3e24f89c78d8bb94db18383987290f88e4edcb#ad3e24f89c78d8bb94db18383987290f88e4edcb"
|
||||
dependencies = [
|
||||
"gc-arena-derive",
|
||||
"sptr",
|
||||
|
@ -1819,8 +1819,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gc-arena-derive"
|
||||
version = "0.2.2"
|
||||
source = "git+https://github.com/kyren/gc-arena?rev=63dab12871321e0e5ada10ff1f1de8f4cf1764f9#63dab12871321e0e5ada10ff1f1de8f4cf1764f9"
|
||||
version = "0.3.1"
|
||||
source = "git+https://github.com/kyren/gc-arena?rev=ad3e24f89c78d8bb94db18383987290f88e4edcb#ad3e24f89c78d8bb94db18383987290f88e4edcb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3816,7 +3816,6 @@ dependencies = [
|
|||
"flv-rs",
|
||||
"fnv",
|
||||
"futures",
|
||||
"gc-arena",
|
||||
"generational-arena",
|
||||
"hashbrown 0.14.0",
|
||||
"indexmap 2.0.0",
|
||||
|
@ -3832,6 +3831,7 @@ dependencies = [
|
|||
"rand",
|
||||
"realfft",
|
||||
"regress",
|
||||
"ruffle_gc_arena",
|
||||
"ruffle_macros",
|
||||
"ruffle_render",
|
||||
"ruffle_video",
|
||||
|
@ -3888,6 +3888,13 @@ dependencies = [
|
|||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ruffle_gc_arena"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"gc-arena",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ruffle_input_format"
|
||||
version = "0.1.0"
|
||||
|
@ -3915,7 +3922,6 @@ dependencies = [
|
|||
"downcast-rs",
|
||||
"enum-map",
|
||||
"flate2",
|
||||
"gc-arena",
|
||||
"gif",
|
||||
"h263-rs-yuv",
|
||||
"jpeg-decoder",
|
||||
|
@ -3925,6 +3931,7 @@ dependencies = [
|
|||
"num-traits",
|
||||
"png",
|
||||
"renderdoc",
|
||||
"ruffle_gc_arena",
|
||||
"ruffle_wstr",
|
||||
"serde",
|
||||
"smallvec",
|
||||
|
@ -3941,9 +3948,9 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"downcast-rs",
|
||||
"fnv",
|
||||
"gc-arena",
|
||||
"js-sys",
|
||||
"log",
|
||||
"ruffle_gc_arena",
|
||||
"ruffle_render",
|
||||
"ruffle_web_common",
|
||||
"swf",
|
||||
|
@ -3958,9 +3965,9 @@ dependencies = [
|
|||
"bytemuck",
|
||||
"downcast-rs",
|
||||
"fnv",
|
||||
"gc-arena",
|
||||
"js-sys",
|
||||
"log",
|
||||
"ruffle_gc_arena",
|
||||
"ruffle_render",
|
||||
"ruffle_web_common",
|
||||
"swf",
|
||||
|
@ -3979,7 +3986,6 @@ dependencies = [
|
|||
"enum-map",
|
||||
"fnv",
|
||||
"futures",
|
||||
"gc-arena",
|
||||
"image",
|
||||
"indexmap 2.0.0",
|
||||
"lru",
|
||||
|
@ -3990,6 +3996,7 @@ dependencies = [
|
|||
"ouroboros",
|
||||
"profiling",
|
||||
"raw-window-handle",
|
||||
"ruffle_gc_arena",
|
||||
"ruffle_render",
|
||||
"swf",
|
||||
"tracing",
|
||||
|
|
|
@ -18,6 +18,8 @@ members = [
|
|||
"render/wgpu",
|
||||
"render/webgl",
|
||||
|
||||
"ruffle_gc_arena",
|
||||
|
||||
"video",
|
||||
"video/software",
|
||||
|
||||
|
@ -36,7 +38,7 @@ repository = "https://github.com/ruffle-rs/ruffle"
|
|||
version = "0.1.0"
|
||||
|
||||
[workspace.dependencies]
|
||||
gc-arena = { git = "https://github.com/kyren/gc-arena", rev = "63dab12871321e0e5ada10ff1f1de8f4cf1764f9" }
|
||||
# gc-arena = { git = "https://github.com/kyren/gc-arena", rev = "ad3e24f89c78d8bb94db18383987290f88e4edcb" }
|
||||
tracing = "0.1.37"
|
||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
||||
naga = { version = "0.12.2", features = ["validate", "wgsl-out"] }
|
||||
|
|
|
@ -13,7 +13,7 @@ byteorder = "1.4"
|
|||
bitstream-io = "1.6.0"
|
||||
flate2 = "1.0.26"
|
||||
fnv = "1.0.7"
|
||||
gc-arena = { workspace = true }
|
||||
gc-arena = { package = "ruffle_gc_arena", path = "../ruffle_gc_arena" }
|
||||
generational-arena = "0.2.9"
|
||||
indexmap = "2.0.0"
|
||||
tracing = { workspace = true }
|
||||
|
|
|
@ -45,7 +45,7 @@ pub struct RegisterSet<'gc>(SmallVec<[Value<'gc>; 8]>);
|
|||
|
||||
unsafe impl<'gc> gc_arena::Collect for RegisterSet<'gc> {
|
||||
#[inline]
|
||||
fn trace(&self, cc: gc_arena::CollectionContext) {
|
||||
fn trace(&self, cc: &gc_arena::Collection) {
|
||||
for register in &self.0 {
|
||||
register.trace(cc);
|
||||
}
|
||||
|
@ -172,6 +172,7 @@ impl<'a> ActivationIdentifier<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Represents a single activation of a given AVM1 function or keyframe.
|
||||
pub struct Activation<'a, 'gc: 'a> {
|
||||
/// Represents the SWF version of a given function.
|
||||
///
|
||||
|
@ -233,6 +234,13 @@ impl Drop for Activation<'_, '_> {
|
|||
}
|
||||
|
||||
impl<'a, 'gc> Activation<'a, 'gc> {
|
||||
/// Convenience method to retrieve the current GC context. Note that explicitely writing
|
||||
/// `self.context.gc_context` can be sometimes necessary to satisfy the borrow checker.
|
||||
#[inline(always)]
|
||||
pub fn gc(&self) -> &'gc gc_arena::Mutation<'gc> {
|
||||
self.context.gc_context
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn from_action(
|
||||
context: UpdateContext<'a, 'gc>,
|
||||
|
@ -357,7 +365,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
|
|||
let clip_obj = active_clip
|
||||
.object()
|
||||
.coerce_to_object(&mut parent_activation);
|
||||
let child_scope = Gc::allocate(
|
||||
let child_scope = Gc::new(
|
||||
parent_activation.context.gc_context,
|
||||
Scope::new(
|
||||
parent_activation.scope(),
|
||||
|
@ -395,7 +403,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
|
|||
Value::Object(o) => o,
|
||||
_ => panic!("No script object for display object"),
|
||||
};
|
||||
let child_scope = Gc::allocate(
|
||||
let child_scope = Gc::new(
|
||||
self.context.gc_context,
|
||||
Scope::new(
|
||||
self.context.avm1.global_scope(),
|
||||
|
@ -869,7 +877,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
|
|||
|
||||
self.context
|
||||
.avm1
|
||||
.set_constant_pool(Gc::allocate(self.context.gc_context, constants));
|
||||
.set_constant_pool(Gc::new(self.context.gc_context, constants));
|
||||
self.set_constant_pool(self.context.avm1.constant_pool());
|
||||
|
||||
Ok(FrameControl::Continue)
|
||||
|
@ -907,7 +915,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
|
|||
.into();
|
||||
let func_obj = FunctionObject::function(
|
||||
self.context.gc_context,
|
||||
Gc::allocate(self.context.gc_context, func),
|
||||
Gc::new(self.context.gc_context, func),
|
||||
self.context.avm1.prototypes().function,
|
||||
prototype,
|
||||
);
|
||||
|
@ -2388,7 +2396,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
|
|||
value => {
|
||||
// Note that primitives get boxed at this point.
|
||||
let object = value.coerce_to_object(self);
|
||||
let with_scope = Gc::allocate(
|
||||
let with_scope = Gc::new(
|
||||
self.context.gc_context,
|
||||
Scope::new_with_scope(self.scope(), object),
|
||||
);
|
||||
|
@ -3017,7 +3025,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
|
|||
pub fn allocate_local_registers(&mut self, num: u8, mc: MutationContext<'gc, '_>) {
|
||||
self.local_registers = match num {
|
||||
0 => None,
|
||||
num => Some(GcCell::allocate(mc, RegisterSet::new(num))),
|
||||
num => Some(GcCell::new(mc, RegisterSet::new(num))),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ impl<'gc> Executable<'gc> {
|
|||
_ => unreachable!(),
|
||||
};
|
||||
// TODO: It would be nice to avoid these extra Scope allocs.
|
||||
let scope = Gc::allocate(
|
||||
let scope = Gc::new(
|
||||
activation.context.gc_context,
|
||||
Scope::new(
|
||||
activation.context.avm1.global_scope(),
|
||||
|
@ -392,7 +392,7 @@ impl<'gc> Executable<'gc> {
|
|||
(swf_version, scope)
|
||||
};
|
||||
|
||||
let child_scope = Gc::allocate(
|
||||
let child_scope = Gc::new(
|
||||
activation.context.gc_context,
|
||||
Scope::new_local_scope(parent_scope, activation.context.gc_context),
|
||||
);
|
||||
|
@ -508,7 +508,7 @@ impl<'gc> FunctionObject<'gc> {
|
|||
) -> Self {
|
||||
Self {
|
||||
base: ScriptObject::new(gc_context, Some(fn_proto)),
|
||||
data: GcCell::allocate(
|
||||
data: GcCell::new(
|
||||
gc_context,
|
||||
FunctionObjectData {
|
||||
function,
|
||||
|
@ -711,7 +711,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(FunctionObject {
|
||||
base: ScriptObject::new(activation.context.gc_context, Some(prototype)),
|
||||
data: GcCell::allocate(
|
||||
data: GcCell::new(
|
||||
activation.context.gc_context,
|
||||
FunctionObjectData {
|
||||
function: None,
|
||||
|
|
|
@ -170,7 +170,7 @@ pub struct BevelFilter<'gc>(GcCell<'gc, BevelFilterData>);
|
|||
|
||||
impl<'gc> BevelFilter<'gc> {
|
||||
fn new(activation: &mut Activation<'_, 'gc>, args: &[Value<'gc>]) -> Result<Self, Error<'gc>> {
|
||||
let bevel_filter = Self(GcCell::allocate(
|
||||
let bevel_filter = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Default::default(),
|
||||
));
|
||||
|
@ -190,11 +190,11 @@ impl<'gc> BevelFilter<'gc> {
|
|||
}
|
||||
|
||||
pub fn from_filter(gc_context: MutationContext<'gc, '_>, filter: swf::BevelFilter) -> Self {
|
||||
Self(GcCell::allocate(gc_context, filter.into()))
|
||||
Self(GcCell::new(gc_context, filter.into()))
|
||||
}
|
||||
|
||||
pub(crate) fn duplicate(&self, gc_context: MutationContext<'gc, '_>) -> Self {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone()))
|
||||
Self(GcCell::new(gc_context, self.0.read().clone()))
|
||||
}
|
||||
|
||||
fn distance(&self) -> f64 {
|
||||
|
|
|
@ -71,10 +71,7 @@ fn new_bitmap_data<'gc>(
|
|||
}
|
||||
object.set_native(
|
||||
gc_context,
|
||||
NativeObject::BitmapData(BitmapDataWrapper::new(GcCell::allocate(
|
||||
gc_context,
|
||||
bitmap_data,
|
||||
))),
|
||||
NativeObject::BitmapData(BitmapDataWrapper::new(GcCell::new(gc_context, bitmap_data))),
|
||||
);
|
||||
object
|
||||
}
|
||||
|
@ -108,7 +105,7 @@ fn constructor<'gc>(
|
|||
let bitmap_data = BitmapData::new(width, height, transparency, fill_color);
|
||||
this.set_native(
|
||||
activation.context.gc_context,
|
||||
NativeObject::BitmapData(BitmapDataWrapper::new(GcCell::allocate(
|
||||
NativeObject::BitmapData(BitmapDataWrapper::new(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
bitmap_data,
|
||||
))),
|
||||
|
|
|
@ -54,7 +54,7 @@ pub struct BlurFilter<'gc>(GcCell<'gc, BlurFilterData>);
|
|||
|
||||
impl<'gc> BlurFilter<'gc> {
|
||||
fn new(activation: &mut Activation<'_, 'gc>, args: &[Value<'gc>]) -> Result<Self, Error<'gc>> {
|
||||
let blur_filter = Self(GcCell::allocate(
|
||||
let blur_filter = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Default::default(),
|
||||
));
|
||||
|
@ -65,11 +65,11 @@ impl<'gc> BlurFilter<'gc> {
|
|||
}
|
||||
|
||||
pub fn from_filter(gc_context: MutationContext<'gc, '_>, filter: swf::BlurFilter) -> Self {
|
||||
Self(GcCell::allocate(gc_context, filter.into()))
|
||||
Self(GcCell::new(gc_context, filter.into()))
|
||||
}
|
||||
|
||||
pub(crate) fn duplicate(&self, gc_context: MutationContext<'gc, '_>) -> Self {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone()))
|
||||
Self(GcCell::new(gc_context, self.0.read().clone()))
|
||||
}
|
||||
|
||||
fn blur_x(&self) -> f64 {
|
||||
|
|
|
@ -51,7 +51,7 @@ pub struct ColorMatrixFilter<'gc>(GcCell<'gc, ColorMatrixFilterData>);
|
|||
|
||||
impl<'gc> ColorMatrixFilter<'gc> {
|
||||
fn new(activation: &mut Activation<'_, 'gc>, args: &[Value<'gc>]) -> Result<Self, Error<'gc>> {
|
||||
let color_matrix_filter = Self(GcCell::allocate(
|
||||
let color_matrix_filter = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Default::default(),
|
||||
));
|
||||
|
@ -63,11 +63,11 @@ impl<'gc> ColorMatrixFilter<'gc> {
|
|||
gc_context: MutationContext<'gc, '_>,
|
||||
filter: swf::ColorMatrixFilter,
|
||||
) -> Self {
|
||||
Self(GcCell::allocate(gc_context, filter.into()))
|
||||
Self(GcCell::new(gc_context, filter.into()))
|
||||
}
|
||||
|
||||
pub(crate) fn duplicate(&self, gc_context: MutationContext<'gc, '_>) -> Self {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone()))
|
||||
Self(GcCell::new(gc_context, self.0.read().clone()))
|
||||
}
|
||||
|
||||
fn matrix(&self, activation: &mut Activation<'_, 'gc>) -> Value<'gc> {
|
||||
|
|
|
@ -129,10 +129,7 @@ pub fn constructor<'gc>(
|
|||
};
|
||||
this.set_native(
|
||||
activation.context.gc_context,
|
||||
NativeObject::ColorTransform(GcCell::allocate(
|
||||
activation.context.gc_context,
|
||||
color_transform,
|
||||
)),
|
||||
NativeObject::ColorTransform(GcCell::new(activation.context.gc_context, color_transform)),
|
||||
);
|
||||
Ok(this.into())
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ pub struct ConvolutionFilter<'gc>(GcCell<'gc, ConvolutionFilterData>);
|
|||
|
||||
impl<'gc> ConvolutionFilter<'gc> {
|
||||
fn new(activation: &mut Activation<'_, 'gc>, args: &[Value<'gc>]) -> Result<Self, Error<'gc>> {
|
||||
let convolution_filter = Self(GcCell::allocate(
|
||||
let convolution_filter = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Default::default(),
|
||||
));
|
||||
|
@ -141,11 +141,11 @@ impl<'gc> ConvolutionFilter<'gc> {
|
|||
gc_context: MutationContext<'gc, '_>,
|
||||
filter: swf::ConvolutionFilter,
|
||||
) -> Self {
|
||||
Self(GcCell::allocate(gc_context, filter.into()))
|
||||
Self(GcCell::new(gc_context, filter.into()))
|
||||
}
|
||||
|
||||
pub(crate) fn duplicate(&self, gc_context: MutationContext<'gc, '_>) -> Self {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone()))
|
||||
Self(GcCell::new(gc_context, self.0.read().clone()))
|
||||
}
|
||||
|
||||
fn matrix_x(&self) -> u8 {
|
||||
|
|
|
@ -372,7 +372,7 @@ fn constructor<'gc>(
|
|||
};
|
||||
this.set_native(
|
||||
activation.context.gc_context,
|
||||
NativeObject::Date(GcCell::allocate(activation.context.gc_context, date)),
|
||||
NativeObject::Date(GcCell::new(activation.context.gc_context, date)),
|
||||
);
|
||||
Ok(this.into())
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ pub struct DisplacementMapFilter<'gc>(GcCell<'gc, DisplacementMapFilterData<'gc>
|
|||
|
||||
impl<'gc> DisplacementMapFilter<'gc> {
|
||||
fn new(activation: &mut Activation<'_, 'gc>, args: &[Value<'gc>]) -> Result<Self, Error<'gc>> {
|
||||
let displacement_map_filter = Self(GcCell::allocate(
|
||||
let displacement_map_filter = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Default::default(),
|
||||
));
|
||||
|
@ -133,11 +133,11 @@ impl<'gc> DisplacementMapFilter<'gc> {
|
|||
gc_context: MutationContext<'gc, '_>,
|
||||
filter: ruffle_render::filters::DisplacementMapFilter,
|
||||
) -> Self {
|
||||
Self(GcCell::allocate(gc_context, filter.into()))
|
||||
Self(GcCell::new(gc_context, filter.into()))
|
||||
}
|
||||
|
||||
pub(crate) fn duplicate(&self, gc_context: MutationContext<'gc, '_>) -> Self {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone()))
|
||||
Self(GcCell::new(gc_context, self.0.read().clone()))
|
||||
}
|
||||
|
||||
fn map_bitmap(&self, context: &mut UpdateContext<'_, 'gc>) -> Option<Object<'gc>> {
|
||||
|
|
|
@ -97,7 +97,7 @@ pub struct DropShadowFilter<'gc>(GcCell<'gc, DropShadowFilterData>);
|
|||
|
||||
impl<'gc> DropShadowFilter<'gc> {
|
||||
fn new(activation: &mut Activation<'_, 'gc>, args: &[Value<'gc>]) -> Result<Self, Error<'gc>> {
|
||||
let drop_shadow_filter = Self(GcCell::allocate(
|
||||
let drop_shadow_filter = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Default::default(),
|
||||
));
|
||||
|
@ -119,11 +119,11 @@ impl<'gc> DropShadowFilter<'gc> {
|
|||
gc_context: MutationContext<'gc, '_>,
|
||||
filter: swf::DropShadowFilter,
|
||||
) -> Self {
|
||||
Self(GcCell::allocate(gc_context, filter.into()))
|
||||
Self(GcCell::new(gc_context, filter.into()))
|
||||
}
|
||||
|
||||
pub(crate) fn duplicate(&self, gc_context: MutationContext<'gc, '_>) -> Self {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone()))
|
||||
Self(GcCell::new(gc_context, self.0.read().clone()))
|
||||
}
|
||||
|
||||
fn distance(&self) -> f64 {
|
||||
|
|
|
@ -85,7 +85,7 @@ pub struct GlowFilter<'gc>(GcCell<'gc, GlowFilterData>);
|
|||
|
||||
impl<'gc> GlowFilter<'gc> {
|
||||
fn new(activation: &mut Activation<'_, 'gc>, args: &[Value<'gc>]) -> Result<Self, Error<'gc>> {
|
||||
let glow_filter = Self(GcCell::allocate(
|
||||
let glow_filter = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Default::default(),
|
||||
));
|
||||
|
@ -101,11 +101,11 @@ impl<'gc> GlowFilter<'gc> {
|
|||
}
|
||||
|
||||
pub fn from_filter(gc_context: MutationContext<'gc, '_>, filter: swf::GlowFilter) -> Self {
|
||||
Self(GcCell::allocate(gc_context, filter.into()))
|
||||
Self(GcCell::new(gc_context, filter.into()))
|
||||
}
|
||||
|
||||
pub(crate) fn duplicate(&self, gc_context: MutationContext<'gc, '_>) -> Self {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone()))
|
||||
Self(GcCell::new(gc_context, self.0.read().clone()))
|
||||
}
|
||||
|
||||
fn color(&self) -> i32 {
|
||||
|
|
|
@ -122,7 +122,7 @@ pub struct GradientFilter<'gc>(GcCell<'gc, GradientFilterData>);
|
|||
|
||||
impl<'gc> GradientFilter<'gc> {
|
||||
fn new(activation: &mut Activation<'_, 'gc>, args: &[Value<'gc>]) -> Result<Self, Error<'gc>> {
|
||||
let gradient_bevel_filter = Self(GcCell::allocate(
|
||||
let gradient_bevel_filter = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Default::default(),
|
||||
));
|
||||
|
@ -141,11 +141,11 @@ impl<'gc> GradientFilter<'gc> {
|
|||
}
|
||||
|
||||
pub fn from_filter(gc_context: MutationContext<'gc, '_>, filter: swf::GradientFilter) -> Self {
|
||||
Self(GcCell::allocate(gc_context, filter.into()))
|
||||
Self(GcCell::new(gc_context, filter.into()))
|
||||
}
|
||||
|
||||
pub(crate) fn duplicate(&self, gc_context: MutationContext<'gc, '_>) -> Self {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone()))
|
||||
Self(GcCell::new(gc_context, self.0.read().clone()))
|
||||
}
|
||||
|
||||
fn distance(&self) -> f64 {
|
||||
|
|
|
@ -135,7 +135,7 @@ fn new_text_format<'gc>(
|
|||
let object = ScriptObject::new(activation.context.gc_context, Some(proto));
|
||||
object.set_native(
|
||||
activation.context.gc_context,
|
||||
NativeObject::TextFormat(GcCell::allocate(activation.context.gc_context, text_format)),
|
||||
NativeObject::TextFormat(GcCell::new(activation.context.gc_context, text_format)),
|
||||
);
|
||||
object
|
||||
}
|
||||
|
|
|
@ -609,7 +609,7 @@ pub fn constructor<'gc>(
|
|||
)?;
|
||||
this.set_native(
|
||||
activation.context.gc_context,
|
||||
NativeObject::TextFormat(GcCell::allocate(activation.context.gc_context, text_format)),
|
||||
NativeObject::TextFormat(GcCell::new(activation.context.gc_context, text_format)),
|
||||
);
|
||||
Ok(this.into())
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ impl fmt::Debug for ScriptObject<'_> {
|
|||
|
||||
impl<'gc> ScriptObject<'gc> {
|
||||
pub fn new(gc_context: MutationContext<'gc, '_>, proto: Option<Object<'gc>>) -> Self {
|
||||
let object = Self(GcCell::allocate(
|
||||
let object = Self(GcCell::new(
|
||||
gc_context,
|
||||
ScriptObjectData {
|
||||
native: NativeObject::None,
|
||||
|
|
|
@ -31,7 +31,7 @@ impl fmt::Debug for SharedObject<'_> {
|
|||
|
||||
impl<'gc> SharedObject<'gc> {
|
||||
pub fn empty_shared_obj(gc_context: MutationContext<'gc, '_>, proto: Object<'gc>) -> Self {
|
||||
SharedObject(GcCell::allocate(
|
||||
SharedObject(GcCell::new(
|
||||
gc_context,
|
||||
SharedObjectData {
|
||||
base: ScriptObject::new(gc_context, Some(proto)),
|
||||
|
|
|
@ -61,7 +61,7 @@ impl<'gc> SoundObject<'gc> {
|
|||
gc_context: MutationContext<'gc, '_>,
|
||||
proto: Object<'gc>,
|
||||
) -> SoundObject<'gc> {
|
||||
SoundObject(GcCell::allocate(
|
||||
SoundObject(GcCell::new(
|
||||
gc_context,
|
||||
SoundObjectData {
|
||||
base: ScriptObject::new(gc_context, Some(proto)),
|
||||
|
|
|
@ -48,7 +48,7 @@ impl<'gc> StageObject<'gc> {
|
|||
display_object: DisplayObject<'gc>,
|
||||
proto: Object<'gc>,
|
||||
) -> Self {
|
||||
Self(GcCell::allocate(
|
||||
Self(GcCell::new(
|
||||
gc_context,
|
||||
StageObjectData {
|
||||
base: ScriptObject::new(gc_context, Some(proto)),
|
||||
|
|
|
@ -42,7 +42,7 @@ pub struct SuperObjectData<'gc> {
|
|||
impl<'gc> SuperObject<'gc> {
|
||||
/// Construct a `super` for an incoming stack frame.
|
||||
pub fn new(activation: &mut Activation<'_, 'gc>, this: Object<'gc>, depth: u8) -> Self {
|
||||
Self(Gc::allocate(
|
||||
Self(Gc::new(
|
||||
activation.context.gc_context,
|
||||
SuperObjectData { this, depth },
|
||||
))
|
||||
|
|
|
@ -48,7 +48,7 @@ impl<'gc> ValueObject<'gc> {
|
|||
_ => None,
|
||||
};
|
||||
|
||||
let obj = ValueObject(GcCell::allocate(
|
||||
let obj = ValueObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ValueObjectData {
|
||||
base: ScriptObject::new(activation.context.gc_context, proto),
|
||||
|
@ -80,7 +80,7 @@ impl<'gc> ValueObject<'gc> {
|
|||
|
||||
/// Construct an empty box to be filled by a constructor.
|
||||
pub fn empty_box(gc_context: MutationContext<'gc, '_>, proto: Object<'gc>) -> Object<'gc> {
|
||||
ValueObject(GcCell::allocate(
|
||||
ValueObject(GcCell::new(
|
||||
gc_context,
|
||||
ValueObjectData {
|
||||
base: ScriptObject::new(gc_context, Some(proto)),
|
||||
|
|
|
@ -28,7 +28,7 @@ impl<'gc> XmlNodeObject<'gc> {
|
|||
mut node: XmlNode<'gc>,
|
||||
proto: Object<'gc>,
|
||||
) -> Self {
|
||||
let object = Self(GcCell::allocate(
|
||||
let object = Self(GcCell::new(
|
||||
gc_context,
|
||||
XmlNodeObjectData {
|
||||
base: ScriptObject::new(gc_context, Some(proto)),
|
||||
|
|
|
@ -83,7 +83,7 @@ impl<'gc> XmlObject<'gc> {
|
|||
/// Construct a new XML document and object pair.
|
||||
pub fn empty(gc_context: MutationContext<'gc, '_>, proto: Object<'gc>) -> Self {
|
||||
let mut root = XmlNode::new(gc_context, ELEMENT_NODE, None);
|
||||
let object = Self(GcCell::allocate(
|
||||
let object = Self(GcCell::new(
|
||||
gc_context,
|
||||
XmlObjectData {
|
||||
base: ScriptObject::new(gc_context, Some(proto)),
|
||||
|
|
|
@ -90,11 +90,11 @@ impl<'gc> MovieClipReference<'gc> {
|
|||
return None;
|
||||
};
|
||||
|
||||
Some(Self(Gc::allocate(
|
||||
Some(Self(Gc::new(
|
||||
activation.context.gc_context,
|
||||
MovieClipReferenceData {
|
||||
path: MovieClipPath::new_from_path(activation, path),
|
||||
cached_stage_object: GcCell::allocate(
|
||||
cached_stage_object: GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Some(cached.as_weak()),
|
||||
),
|
||||
|
|
|
@ -109,7 +109,7 @@ impl<'gc, V> PropertyMap<'gc, V> {
|
|||
}
|
||||
|
||||
unsafe impl<'gc, V: Collect> Collect for PropertyMap<'gc, V> {
|
||||
fn trace(&self, cc: gc_arena::CollectionContext) {
|
||||
fn trace(&self, cc: &gc_arena::Collection) {
|
||||
for (key, value) in &self.0 {
|
||||
key.0.trace(cc);
|
||||
value.trace(cc);
|
||||
|
|
|
@ -79,8 +79,8 @@ impl<'gc> Avm1<'gc> {
|
|||
|
||||
Self {
|
||||
player_version,
|
||||
constant_pool: Gc::allocate(gc_context, vec![]),
|
||||
global_scope: Gc::allocate(gc_context, Scope::from_global_object(globals)),
|
||||
constant_pool: Gc::new(gc_context, vec![]),
|
||||
global_scope: Gc::new(gc_context, Scope::from_global_object(globals)),
|
||||
prototypes,
|
||||
broadcaster_functions,
|
||||
display_properties: stage_object::DisplayPropertyMap::new(),
|
||||
|
@ -126,7 +126,7 @@ impl<'gc> Avm1<'gc> {
|
|||
let clip_obj = active_clip
|
||||
.object()
|
||||
.coerce_to_object(&mut parent_activation);
|
||||
let child_scope = Gc::allocate(
|
||||
let child_scope = Gc::new(
|
||||
parent_activation.context.gc_context,
|
||||
Scope::new(
|
||||
parent_activation.scope(),
|
||||
|
@ -166,7 +166,7 @@ impl<'gc> Avm1<'gc> {
|
|||
Value::Object(o) => o,
|
||||
_ => panic!("No script object for display object"),
|
||||
};
|
||||
let child_scope = Gc::allocate(
|
||||
let child_scope = Gc::new(
|
||||
action_context.gc_context,
|
||||
Scope::new(
|
||||
action_context.avm1.global_scope,
|
||||
|
@ -210,7 +210,7 @@ impl<'gc> Avm1<'gc> {
|
|||
let clip_obj = active_clip
|
||||
.object()
|
||||
.coerce_to_object(&mut parent_activation);
|
||||
let child_scope = Gc::allocate(
|
||||
let child_scope = Gc::new(
|
||||
parent_activation.context.gc_context,
|
||||
Scope::new(
|
||||
parent_activation.scope(),
|
||||
|
|
|
@ -72,7 +72,7 @@ impl<'gc> Scope<'gc> {
|
|||
scope.parent = scope.parent.map(|p| Self::new_target_scope(p, clip, mc));
|
||||
}
|
||||
|
||||
Gc::allocate(mc, scope)
|
||||
Gc::new(mc, scope)
|
||||
}
|
||||
|
||||
/// Construct a with scope to be used as the scope during a with block.
|
||||
|
|
|
@ -164,7 +164,7 @@ impl<'gc> Avm2<'gc> {
|
|||
player_version,
|
||||
stack: Vec::new(),
|
||||
scope_stack: Vec::new(),
|
||||
call_stack: GcCell::allocate(context.gc_context, CallStack::new()),
|
||||
call_stack: GcCell::new(context.gc_context, CallStack::new()),
|
||||
playerglobals_domain,
|
||||
stage_domain,
|
||||
system_classes: None,
|
||||
|
|
|
@ -43,7 +43,7 @@ pub struct RegisterSet<'gc>(SmallVec<[Value<'gc>; 8]>);
|
|||
|
||||
unsafe impl<'gc> gc_arena::Collect for RegisterSet<'gc> {
|
||||
#[inline]
|
||||
fn trace(&self, cc: gc_arena::CollectionContext) {
|
||||
fn trace(&self, cc: &gc_arena::Collection) {
|
||||
for register in &self.0 {
|
||||
register.trace(cc);
|
||||
}
|
||||
|
@ -139,6 +139,13 @@ pub struct Activation<'a, 'gc: 'a> {
|
|||
}
|
||||
|
||||
impl<'a, 'gc> Activation<'a, 'gc> {
|
||||
/// Convenience method to retrieve the current GC context. Note that explicitely writing
|
||||
/// `self.context.gc_context` can be sometimes necessary to satisfy the borrow checker.
|
||||
#[inline(always)]
|
||||
pub fn gc(&self) -> &'gc gc_arena::Mutation<'gc> {
|
||||
self.context.gc_context
|
||||
}
|
||||
|
||||
/// Construct an activation that does not represent any particular scope.
|
||||
///
|
||||
/// This exists primarily for non-AVM2 related manipulations of the
|
||||
|
@ -764,7 +771,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
|
|||
.pool_maybe_uninitialized_multiname(index, &mut self.borrow_gc())?;
|
||||
if name.has_lazy_component() {
|
||||
let name = name.fill_with_runtime_params(self)?;
|
||||
Ok(Gc::allocate(self.context.gc_context, name))
|
||||
Ok(Gc::new(self.context.gc_context, name))
|
||||
} else {
|
||||
Ok(name)
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ impl<'gc> Class<'gc> {
|
|||
) -> GcCell<'gc, Self> {
|
||||
let native_instance_init = instance_init.clone();
|
||||
|
||||
GcCell::allocate(
|
||||
GcCell::new(
|
||||
mc,
|
||||
Self {
|
||||
name,
|
||||
|
@ -268,7 +268,7 @@ impl<'gc> Class<'gc> {
|
|||
AvmString::new_utf8(mc, name_with_params),
|
||||
);
|
||||
|
||||
let new_class = GcCell::allocate(mc, new_class);
|
||||
let new_class = GcCell::new(mc, new_class);
|
||||
drop(read);
|
||||
|
||||
this.write(mc).applications.insert(key, new_class);
|
||||
|
@ -378,7 +378,7 @@ impl<'gc> Class<'gc> {
|
|||
}
|
||||
}
|
||||
|
||||
Ok(GcCell::allocate(
|
||||
Ok(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Self {
|
||||
name,
|
||||
|
@ -538,7 +538,7 @@ impl<'gc> Class<'gc> {
|
|||
)?);
|
||||
}
|
||||
|
||||
Ok(GcCell::allocate(
|
||||
Ok(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Self {
|
||||
name: QName::new(activation.avm2().public_namespace, name),
|
||||
|
|
|
@ -55,7 +55,7 @@ impl<'gc> Domain<'gc> {
|
|||
mc: MutationContext<'gc, '_>,
|
||||
parent: Option<Domain<'gc>>,
|
||||
) -> Domain<'gc> {
|
||||
Self(GcCell::allocate(
|
||||
Self(GcCell::new(
|
||||
mc,
|
||||
DomainData {
|
||||
defs: PropertyMap::new(),
|
||||
|
@ -75,7 +75,7 @@ impl<'gc> Domain<'gc> {
|
|||
/// This function must not be called before the player globals have been
|
||||
/// fully allocated.
|
||||
pub fn movie_domain(activation: &mut Activation<'_, 'gc>, parent: Domain<'gc>) -> Domain<'gc> {
|
||||
let this = Self(GcCell::allocate(
|
||||
let this = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
DomainData {
|
||||
defs: PropertyMap::new(),
|
||||
|
|
|
@ -68,7 +68,7 @@ pub enum E4XNodeKind<'gc> {
|
|||
|
||||
impl<'gc> E4XNode<'gc> {
|
||||
pub fn dummy(mc: MutationContext<'gc, '_>) -> Self {
|
||||
E4XNode(GcCell::allocate(
|
||||
E4XNode(GcCell::new(
|
||||
mc,
|
||||
E4XNodeData {
|
||||
parent: None,
|
||||
|
@ -82,7 +82,7 @@ impl<'gc> E4XNode<'gc> {
|
|||
}
|
||||
|
||||
pub fn text(mc: MutationContext<'gc, '_>, text: AvmString<'gc>, parent: Option<Self>) -> Self {
|
||||
E4XNode(GcCell::allocate(
|
||||
E4XNode(GcCell::new(
|
||||
mc,
|
||||
E4XNodeData {
|
||||
parent,
|
||||
|
@ -93,7 +93,7 @@ impl<'gc> E4XNode<'gc> {
|
|||
}
|
||||
|
||||
pub fn element(mc: MutationContext<'gc, '_>, name: AvmString<'gc>, parent: Self) -> Self {
|
||||
E4XNode(GcCell::allocate(
|
||||
E4XNode(GcCell::new(
|
||||
mc,
|
||||
E4XNodeData {
|
||||
parent: Some(parent),
|
||||
|
@ -112,7 +112,7 @@ impl<'gc> E4XNode<'gc> {
|
|||
value: AvmString<'gc>,
|
||||
parent: E4XNode<'gc>,
|
||||
) -> Self {
|
||||
E4XNode(GcCell::allocate(
|
||||
E4XNode(GcCell::new(
|
||||
mc,
|
||||
E4XNodeData {
|
||||
parent: Some(parent),
|
||||
|
@ -191,7 +191,7 @@ impl<'gc> E4XNode<'gc> {
|
|||
},
|
||||
};
|
||||
|
||||
let node = E4XNode(GcCell::allocate(
|
||||
let node = E4XNode(GcCell::new(
|
||||
mc,
|
||||
E4XNodeData {
|
||||
parent: None,
|
||||
|
@ -360,7 +360,7 @@ impl<'gc> E4XNode<'gc> {
|
|||
text
|
||||
},
|
||||
);
|
||||
let node = E4XNode(GcCell::allocate(
|
||||
let node = E4XNode(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
E4XNodeData {
|
||||
parent: None,
|
||||
|
@ -445,7 +445,7 @@ impl<'gc> E4XNode<'gc> {
|
|||
Event::PI(_) => E4XNodeKind::ProcessingInstruction(text),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let node = E4XNode(GcCell::allocate(
|
||||
let node = E4XNode(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
E4XNodeData {
|
||||
parent: None,
|
||||
|
@ -494,10 +494,7 @@ impl<'gc> E4XNode<'gc> {
|
|||
local_name: Some(key),
|
||||
kind: E4XNodeKind::Attribute(value),
|
||||
};
|
||||
let attribute = E4XNode(GcCell::allocate(
|
||||
activation.context.gc_context,
|
||||
attribute_data,
|
||||
));
|
||||
let attribute = E4XNode(GcCell::new(activation.context.gc_context, attribute_data));
|
||||
attribute_nodes.push(attribute);
|
||||
}
|
||||
|
||||
|
@ -510,10 +507,7 @@ impl<'gc> E4XNode<'gc> {
|
|||
},
|
||||
};
|
||||
|
||||
Ok(E4XNode(GcCell::allocate(
|
||||
activation.context.gc_context,
|
||||
data,
|
||||
)))
|
||||
Ok(E4XNode(GcCell::new(activation.context.gc_context, data)))
|
||||
}
|
||||
|
||||
pub fn local_name(&self) -> Option<AvmString<'gc>> {
|
||||
|
|
|
@ -29,7 +29,7 @@ pub trait FilterAvm2Ext {
|
|||
#[derive(Clone, Collect)]
|
||||
#[collect(require_static)]
|
||||
pub struct ObjectWrapper {
|
||||
root: DynamicRoot<Rootable![Object<'gc>]>,
|
||||
root: DynamicRoot<Rootable![Object<'_>]>,
|
||||
}
|
||||
|
||||
impl ShaderObject for ObjectWrapper {
|
||||
|
|
|
@ -68,7 +68,7 @@ pub fn fill_bitmap_data_from_symbol<'gc>(
|
|||
activation: &mut Activation<'_, 'gc>,
|
||||
bd: &Bitmap<'gc>,
|
||||
) -> BitmapDataWrapper<'gc> {
|
||||
let new_bitmap_data = GcCell::allocate(
|
||||
let new_bitmap_data = GcCell::new(
|
||||
activation.context.gc_context,
|
||||
BitmapData::new_with_pixels(
|
||||
Bitmap::width(*bd).into(),
|
||||
|
@ -134,10 +134,7 @@ pub fn init<'gc>(
|
|||
}
|
||||
|
||||
let new_bitmap_data = BitmapData::new(width, height, transparency, fill_color);
|
||||
BitmapDataWrapper::new(GcCell::allocate(
|
||||
activation.context.gc_context,
|
||||
new_bitmap_data,
|
||||
))
|
||||
BitmapDataWrapper::new(GcCell::new(activation.context.gc_context, new_bitmap_data))
|
||||
};
|
||||
|
||||
new_bitmap_data.init_object2(activation.context.gc_context, this);
|
||||
|
@ -1133,10 +1130,7 @@ pub fn clone<'gc>(
|
|||
let class = activation.avm2().classes().bitmapdata;
|
||||
let new_bitmap_data_object = BitmapDataObject::from_bitmap_data_internal(
|
||||
activation,
|
||||
BitmapDataWrapper::new(GcCell::allocate(
|
||||
activation.context.gc_context,
|
||||
new_bitmap_data,
|
||||
)),
|
||||
BitmapDataWrapper::new(GcCell::new(activation.context.gc_context, new_bitmap_data)),
|
||||
class,
|
||||
)?;
|
||||
|
||||
|
@ -1398,10 +1392,7 @@ pub fn compare<'gc>(
|
|||
let class = activation.avm2().classes().bitmapdata;
|
||||
Ok(BitmapDataObject::from_bitmap_data_internal(
|
||||
activation,
|
||||
BitmapDataWrapper::new(GcCell::allocate(
|
||||
activation.context.gc_context,
|
||||
bitmap_data,
|
||||
)),
|
||||
BitmapDataWrapper::new(GcCell::new(activation.context.gc_context, bitmap_data)),
|
||||
class,
|
||||
)?
|
||||
.into())
|
||||
|
|
|
@ -153,7 +153,7 @@ impl<'gc> BytecodeMethod<'gc> {
|
|||
.clone();
|
||||
|
||||
let activation_class = if method.flags.contains(AbcMethodFlags::NEED_ACTIVATION) {
|
||||
Some(GcCell::allocate(activation.context.gc_context, None))
|
||||
Some(GcCell::new(activation.context.gc_context, None))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -323,7 +323,7 @@ impl<'gc> Method<'gc> {
|
|||
is_variadic: bool,
|
||||
mc: MutationContext<'gc, '_>,
|
||||
) -> Self {
|
||||
Self::Native(Gc::allocate(
|
||||
Self::Native(Gc::new(
|
||||
mc,
|
||||
NativeMethod {
|
||||
method,
|
||||
|
@ -342,7 +342,7 @@ impl<'gc> Method<'gc> {
|
|||
name: &'static str,
|
||||
mc: MutationContext<'gc, '_>,
|
||||
) -> Self {
|
||||
Self::Native(Gc::allocate(
|
||||
Self::Native(Gc::new(
|
||||
mc,
|
||||
NativeMethod {
|
||||
method,
|
||||
|
|
|
@ -24,7 +24,7 @@ enum NamespaceSet<'gc> {
|
|||
|
||||
impl<'gc> NamespaceSet<'gc> {
|
||||
pub fn multiple(set: Vec<Namespace<'gc>>, mc: MutationContext<'gc, '_>) -> Self {
|
||||
Self::Multiple(Gc::allocate(mc, set))
|
||||
Self::Multiple(Gc::new(mc, set))
|
||||
}
|
||||
pub fn single(ns: Namespace<'gc>) -> Self {
|
||||
Self::Single(ns)
|
||||
|
|
|
@ -85,11 +85,11 @@ impl<'gc> Namespace<'gc> {
|
|||
NamespaceData::Private(translation_unit.pool_string(idx.0, context)?)
|
||||
}
|
||||
};
|
||||
Ok(Self(Gc::allocate(context.gc_context, ns)))
|
||||
Ok(Self(Gc::new(context.gc_context, ns)))
|
||||
}
|
||||
|
||||
pub fn any(mc: MutationContext<'gc, '_>) -> Self {
|
||||
Self(Gc::allocate(mc, NamespaceData::Any))
|
||||
Self(Gc::new(mc, NamespaceData::Any))
|
||||
}
|
||||
|
||||
// TODO(moulins): allow passing an AvmAtom or a non-static `&WStr` directly
|
||||
|
@ -100,10 +100,7 @@ impl<'gc> Namespace<'gc> {
|
|||
let atom = context
|
||||
.interner
|
||||
.intern(context.gc_context, package_name.into());
|
||||
Self(Gc::allocate(
|
||||
context.gc_context,
|
||||
NamespaceData::Namespace(atom),
|
||||
))
|
||||
Self(Gc::new(context.gc_context, NamespaceData::Namespace(atom)))
|
||||
}
|
||||
|
||||
// TODO(moulins): allow passing an AvmAtom or a non-static `&WStr` directly
|
||||
|
@ -114,7 +111,7 @@ impl<'gc> Namespace<'gc> {
|
|||
let atom = context
|
||||
.interner
|
||||
.intern(context.gc_context, package_name.into());
|
||||
Self(Gc::allocate(
|
||||
Self(Gc::new(
|
||||
context.gc_context,
|
||||
NamespaceData::PackageInternal(atom),
|
||||
))
|
||||
|
|
|
@ -19,7 +19,7 @@ pub fn array_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(ArrayObject(GcCell::allocate(
|
||||
Ok(ArrayObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ArrayObjectData {
|
||||
base,
|
||||
|
@ -72,7 +72,7 @@ impl<'gc> ArrayObject<'gc> {
|
|||
let class = activation.avm2().classes().array;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut instance: Object<'gc> = ArrayObject(GcCell::allocate(
|
||||
let mut instance: Object<'gc> = ArrayObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ArrayObjectData { base, array },
|
||||
))
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn bitmap_data_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(BitmapDataObject(GcCell::allocate(
|
||||
Ok(BitmapDataObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
BitmapDataObjectData {
|
||||
base,
|
||||
|
@ -70,7 +70,7 @@ impl<'gc> BitmapDataObject<'gc> {
|
|||
bitmap_data: BitmapDataWrapper<'gc>,
|
||||
class: ClassObject<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let mut instance: Object<'gc> = Self(GcCell::allocate(
|
||||
let mut instance: Object<'gc> = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
BitmapDataObjectData {
|
||||
base: ScriptObjectData::new(class),
|
||||
|
|
|
@ -40,7 +40,7 @@ pub fn byte_array_allocator<'gc>(
|
|||
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(ByteArrayObject(GcCell::allocate(
|
||||
Ok(ByteArrayObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ByteArrayObjectData { base, storage },
|
||||
))
|
||||
|
@ -80,7 +80,7 @@ impl<'gc> ByteArrayObject<'gc> {
|
|||
let class = activation.avm2().classes().bytearray;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut instance: Object<'gc> = ByteArrayObject(GcCell::allocate(
|
||||
let mut instance: Object<'gc> = ByteArrayObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ByteArrayObjectData {
|
||||
base,
|
||||
|
|
|
@ -194,7 +194,7 @@ impl<'gc> ClassObject<'gc> {
|
|||
.or_else(|| superclass_object.and_then(|c| c.instance_allocator()))
|
||||
.unwrap_or(scriptobject_allocator);
|
||||
|
||||
let class_object = ClassObject(GcCell::allocate(
|
||||
let class_object = ClassObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ClassObjectData {
|
||||
base: ScriptObjectData::custom_new(None, None),
|
||||
|
@ -953,7 +953,7 @@ impl<'gc> TObject<'gc> for ClassObject<'gc> {
|
|||
let native_constructor = self.0.read().native_constructor.clone();
|
||||
let call_handler = self.0.read().call_handler.clone();
|
||||
|
||||
let mut class_object = ClassObject(GcCell::allocate(
|
||||
let mut class_object = ClassObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ClassObjectData {
|
||||
base: ScriptObjectData::new(class_class),
|
||||
|
|
|
@ -40,7 +40,7 @@ impl<'gc> Context3DObject<'gc> {
|
|||
let class = activation.avm2().classes().context3d;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut this: Object<'gc> = Context3DObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = Context3DObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Context3DData {
|
||||
base,
|
||||
|
@ -264,7 +264,7 @@ impl<'gc> Context3DObject<'gc> {
|
|||
) {
|
||||
let module = match program {
|
||||
Some(program) => program.shader_module_handle(),
|
||||
None => GcCell::allocate(activation.context.gc_context, None),
|
||||
None => GcCell::new(activation.context.gc_context, None),
|
||||
};
|
||||
|
||||
self.0
|
||||
|
|
|
@ -15,7 +15,7 @@ pub fn date_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(DateObject(GcCell::allocate(
|
||||
Ok(DateObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
DateObjectData {
|
||||
base,
|
||||
|
|
|
@ -18,7 +18,7 @@ pub fn dictionary_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(DictionaryObject(GcCell::allocate(
|
||||
Ok(DictionaryObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
DictionaryObjectData {
|
||||
base,
|
||||
|
|
|
@ -67,7 +67,7 @@ impl<'gc> DispatchObject<'gc> {
|
|||
// TODO: we might want this to be a proper Object instance, just in case
|
||||
let base = ScriptObjectData::custom_new(None, None);
|
||||
|
||||
DispatchObject(GcCell::allocate(
|
||||
DispatchObject(GcCell::new(
|
||||
mc,
|
||||
DispatchObjectData {
|
||||
base,
|
||||
|
|
|
@ -18,7 +18,7 @@ pub fn application_domain_allocator<'gc>(
|
|||
let domain = activation.domain();
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(DomainObject(GcCell::allocate(
|
||||
Ok(DomainObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
DomainObjectData { base, domain },
|
||||
))
|
||||
|
@ -62,7 +62,7 @@ impl<'gc> DomainObject<'gc> {
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let class = activation.avm2().classes().application_domain;
|
||||
let base = ScriptObjectData::new(class);
|
||||
let mut this: Object<'gc> = DomainObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = DomainObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
DomainObjectData { base, domain },
|
||||
))
|
||||
|
|
|
@ -21,7 +21,7 @@ pub fn error_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(ErrorObject(GcCell::allocate(
|
||||
Ok(ErrorObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ErrorObjectData {
|
||||
base,
|
||||
|
|
|
@ -22,7 +22,7 @@ pub fn event_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(EventObject(GcCell::allocate(
|
||||
Ok(EventObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
EventObjectData {
|
||||
base,
|
||||
|
@ -81,7 +81,7 @@ impl<'gc> EventObject<'gc> {
|
|||
event.set_bubbles(bubbles);
|
||||
event.set_cancelable(cancelable);
|
||||
|
||||
let event_object = EventObject(GcCell::allocate(
|
||||
let event_object = EventObject(GcCell::new(
|
||||
context.gc_context,
|
||||
EventObjectData { base, event },
|
||||
));
|
||||
|
|
|
@ -25,7 +25,7 @@ pub fn function_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let dummy = Gc::allocate(
|
||||
let dummy = Gc::new(
|
||||
activation.context.gc_context,
|
||||
NativeMethod {
|
||||
method: |_, _, _| Ok(Value::Undefined),
|
||||
|
@ -36,7 +36,7 @@ pub fn function_allocator<'gc>(
|
|||
},
|
||||
);
|
||||
|
||||
Ok(FunctionObject(GcCell::allocate(
|
||||
Ok(FunctionObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
FunctionObjectData {
|
||||
base,
|
||||
|
@ -120,7 +120,7 @@ impl<'gc> FunctionObject<'gc> {
|
|||
let fn_class = activation.avm2().classes().function;
|
||||
let exec = Executable::from_method(method, scope, receiver, subclass_object);
|
||||
|
||||
FunctionObject(GcCell::allocate(
|
||||
FunctionObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
FunctionObjectData {
|
||||
base: ScriptObjectData::new(fn_class),
|
||||
|
|
|
@ -28,7 +28,7 @@ impl<'gc> IndexBuffer3DObject<'gc> {
|
|||
let class = activation.avm2().classes().indexbuffer3d;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut this: Object<'gc> = IndexBuffer3DObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = IndexBuffer3DObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
IndexBuffer3DObjectData {
|
||||
base,
|
||||
|
|
|
@ -22,7 +22,7 @@ pub fn loader_info_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(LoaderInfoObject(GcCell::allocate(
|
||||
Ok(LoaderInfoObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
LoaderInfoObjectData {
|
||||
base,
|
||||
|
@ -128,7 +128,7 @@ impl<'gc> LoaderInfoObject<'gc> {
|
|||
let base = ScriptObjectData::new(class);
|
||||
let loaded_stream = Some(LoaderStream::Swf(movie, root));
|
||||
|
||||
let mut this: Object<'gc> = LoaderInfoObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = LoaderInfoObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
LoaderInfoObjectData {
|
||||
base,
|
||||
|
@ -172,7 +172,7 @@ impl<'gc> LoaderInfoObject<'gc> {
|
|||
let class = activation.avm2().classes().loaderinfo;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut this: Object<'gc> = LoaderInfoObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = LoaderInfoObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
LoaderInfoObjectData {
|
||||
base,
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn namespace_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(NamespaceObject(GcCell::allocate(
|
||||
Ok(NamespaceObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
NamespaceObjectData {
|
||||
base,
|
||||
|
@ -63,7 +63,7 @@ impl<'gc> NamespaceObject<'gc> {
|
|||
let class = activation.avm2().classes().namespace;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut this: Object<'gc> = NamespaceObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = NamespaceObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
NamespaceObjectData { base, namespace },
|
||||
))
|
||||
|
|
|
@ -16,7 +16,7 @@ pub fn netstream_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
let ns = NetStream::new(activation.context.gc_context, None);
|
||||
let this: Object<'gc> = NetStreamObject(GcCell::allocate(
|
||||
let this: Object<'gc> = NetStreamObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
NetStreamObjectData { base, ns },
|
||||
))
|
||||
|
|
|
@ -18,7 +18,7 @@ pub fn primitive_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(PrimitiveObject(GcCell::allocate(
|
||||
Ok(PrimitiveObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
PrimitiveObjectData {
|
||||
base,
|
||||
|
@ -86,7 +86,7 @@ impl<'gc> PrimitiveObject<'gc> {
|
|||
};
|
||||
|
||||
let base = ScriptObjectData::new(class);
|
||||
let mut this: Object<'gc> = PrimitiveObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = PrimitiveObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
PrimitiveObjectData { base, primitive },
|
||||
))
|
||||
|
|
|
@ -28,12 +28,12 @@ impl<'gc> Program3DObject<'gc> {
|
|||
let class = activation.avm2().classes().program3d;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut this: Object<'gc> = Program3DObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = Program3DObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Program3DObjectData {
|
||||
base,
|
||||
context3d,
|
||||
shader_module_handle: GcCell::allocate(activation.context.gc_context, None),
|
||||
shader_module_handle: GcCell::new(activation.context.gc_context, None),
|
||||
},
|
||||
))
|
||||
.into();
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn proxy_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(ProxyObject(GcCell::allocate(
|
||||
Ok(ProxyObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ProxyObjectData { base },
|
||||
))
|
||||
|
|
|
@ -19,7 +19,7 @@ pub fn q_name_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(QNameObject(GcCell::allocate(
|
||||
Ok(QNameObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
QNameObjectData {
|
||||
base,
|
||||
|
@ -65,7 +65,7 @@ impl<'gc> QNameObject<'gc> {
|
|||
let class = activation.avm2().classes().qname;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut this: Object<'gc> = QNameObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = QNameObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
QNameObjectData { base, name },
|
||||
))
|
||||
|
|
|
@ -18,7 +18,7 @@ pub fn reg_exp_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(RegExpObject(GcCell::allocate(
|
||||
Ok(RegExpObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
RegExpObjectData {
|
||||
base,
|
||||
|
@ -61,7 +61,7 @@ impl<'gc> RegExpObject<'gc> {
|
|||
let class = activation.avm2().classes().regexp;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut this: Object<'gc> = RegExpObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = RegExpObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
RegExpObjectData { base, regexp },
|
||||
))
|
||||
|
|
|
@ -21,7 +21,7 @@ pub fn scriptobject_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(ScriptObject(GcCell::allocate(activation.context.gc_context, base)).into())
|
||||
Ok(ScriptObject(GcCell::new(activation.context.gc_context, base)).into())
|
||||
}
|
||||
|
||||
/// Default implementation of `avm2::Object`.
|
||||
|
@ -101,11 +101,7 @@ impl<'gc> ScriptObject<'gc> {
|
|||
class: Option<ClassObject<'gc>>,
|
||||
proto: Option<Object<'gc>>,
|
||||
) -> Object<'gc> {
|
||||
ScriptObject(GcCell::allocate(
|
||||
mc,
|
||||
ScriptObjectData::custom_new(proto, class),
|
||||
))
|
||||
.into()
|
||||
ScriptObject(GcCell::new(mc, ScriptObjectData::custom_new(proto, class))).into()
|
||||
}
|
||||
|
||||
/// A special case for `newcatch` implementation. Basically a variable (q)name
|
||||
|
@ -118,7 +114,7 @@ impl<'gc> ScriptObject<'gc> {
|
|||
base.set_vtable(vt);
|
||||
base.install_instance_slots();
|
||||
|
||||
ScriptObject(GcCell::allocate(mc, base)).into()
|
||||
ScriptObject(GcCell::new(mc, base)).into()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn shader_data_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(ShaderDataObject(GcCell::allocate(
|
||||
Ok(ShaderDataObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ShaderDataObjectData { base, shader: None },
|
||||
))
|
||||
|
|
|
@ -22,7 +22,7 @@ pub fn sound_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(SoundObject(GcCell::allocate(
|
||||
Ok(SoundObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
SoundObjectData {
|
||||
base,
|
||||
|
|
|
@ -19,7 +19,7 @@ pub fn sound_channel_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(SoundChannelObject(GcCell::allocate(
|
||||
Ok(SoundChannelObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
SoundChannelObjectData {
|
||||
base,
|
||||
|
@ -81,7 +81,7 @@ impl<'gc> SoundChannelObject<'gc> {
|
|||
let class = activation.avm2().classes().soundchannel;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut sound_object = SoundChannelObject(GcCell::allocate(
|
||||
let mut sound_object = SoundChannelObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
SoundChannelObjectData {
|
||||
base,
|
||||
|
|
|
@ -16,7 +16,7 @@ pub fn stage_3d_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(Stage3DObject(GcCell::allocate(
|
||||
Ok(Stage3DObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
Stage3DObjectData {
|
||||
base,
|
||||
|
|
|
@ -46,7 +46,7 @@ impl<'gc> StageObject<'gc> {
|
|||
display_object: DisplayObject<'gc>,
|
||||
class: ClassObject<'gc>,
|
||||
) -> Result<Self, Error<'gc>> {
|
||||
let mut instance = Self(GcCell::allocate(
|
||||
let mut instance = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
StageObjectData {
|
||||
base: ScriptObjectData::new(class),
|
||||
|
@ -96,7 +96,7 @@ impl<'gc> StageObject<'gc> {
|
|||
display_object: DisplayObject<'gc>,
|
||||
) -> Result<Self, Error<'gc>> {
|
||||
let class = activation.avm2().classes().graphics;
|
||||
let mut this = Self(GcCell::allocate(
|
||||
let mut this = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
StageObjectData {
|
||||
base: ScriptObjectData::new(class),
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn textformat_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(TextFormatObject(GcCell::allocate(
|
||||
Ok(TextFormatObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
TextFormatObjectData {
|
||||
base,
|
||||
|
@ -60,7 +60,7 @@ impl<'gc> TextFormatObject<'gc> {
|
|||
let class = activation.avm2().classes().textformat;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut this: Object<'gc> = Self(GcCell::allocate(
|
||||
let mut this: Object<'gc> = Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
TextFormatObjectData { base, text_format },
|
||||
))
|
||||
|
|
|
@ -29,7 +29,7 @@ impl<'gc> TextureObject<'gc> {
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut this: Object<'gc> = TextureObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = TextureObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
TextureObjectData {
|
||||
base,
|
||||
|
|
|
@ -27,7 +27,7 @@ pub fn vector_allocator<'gc>(
|
|||
.flatten()
|
||||
.unwrap_or_else(|| activation.avm2().classes().object);
|
||||
|
||||
Ok(VectorObject(GcCell::allocate(
|
||||
Ok(VectorObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
VectorObjectData {
|
||||
base,
|
||||
|
@ -75,7 +75,7 @@ impl<'gc> VectorObject<'gc> {
|
|||
|
||||
let applied_class = vector_class.apply(activation, value_type.into())?;
|
||||
|
||||
let mut object: Object<'gc> = VectorObject(GcCell::allocate(
|
||||
let mut object: Object<'gc> = VectorObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
VectorObjectData {
|
||||
base: ScriptObjectData::new(applied_class),
|
||||
|
|
|
@ -30,7 +30,7 @@ impl<'gc> VertexBuffer3DObject<'gc> {
|
|||
let class = activation.avm2().classes().vertexbuffer3d;
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
let mut this: Object<'gc> = VertexBuffer3DObject(GcCell::allocate(
|
||||
let mut this: Object<'gc> = VertexBuffer3DObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
VertexBuffer3DObjectData {
|
||||
base,
|
||||
|
|
|
@ -18,7 +18,7 @@ pub fn xml_list_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(XmlListObject(GcCell::allocate(
|
||||
Ok(XmlListObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
XmlListObjectData {
|
||||
base,
|
||||
|
@ -54,7 +54,7 @@ impl<'gc> XmlListObject<'gc> {
|
|||
target: Option<Object<'gc>>,
|
||||
) -> Self {
|
||||
let base = ScriptObjectData::new(activation.context.avm2.classes().xml_list);
|
||||
XmlListObject(GcCell::allocate(
|
||||
XmlListObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
XmlListObjectData {
|
||||
base,
|
||||
|
|
|
@ -21,7 +21,7 @@ pub fn xml_allocator<'gc>(
|
|||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObjectData::new(class);
|
||||
|
||||
Ok(XmlObject(GcCell::allocate(
|
||||
Ok(XmlObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
XmlObjectData {
|
||||
base,
|
||||
|
@ -58,7 +58,7 @@ pub struct XmlObjectData<'gc> {
|
|||
|
||||
impl<'gc> XmlObject<'gc> {
|
||||
pub fn new(node: E4XNode<'gc>, activation: &mut Activation<'_, 'gc>) -> Self {
|
||||
XmlObject(GcCell::allocate(
|
||||
XmlObject(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
XmlObjectData {
|
||||
base: ScriptObjectData::new(activation.context.avm2.classes().xml),
|
||||
|
|
|
@ -50,7 +50,7 @@ impl<'gc> PropertyClass<'gc> {
|
|||
name: Multiname<'gc>,
|
||||
unit: Option<TranslationUnit<'gc>>,
|
||||
) -> Self {
|
||||
PropertyClass::Name(Gc::allocate(mc, (name, unit)))
|
||||
PropertyClass::Name(Gc::new(mc, (name, unit)))
|
||||
}
|
||||
|
||||
/// Returns `value` coerced to the type of this `PropertyClass`.
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::avm2::Multiname;
|
|||
use crate::avm2::Namespace;
|
||||
use crate::avm2::QName;
|
||||
use fnv::FnvBuildHasher;
|
||||
use gc_arena::{Collect, CollectionContext};
|
||||
use gc_arena::Collect;
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::HashMap;
|
||||
use std::mem::swap;
|
||||
|
@ -34,7 +34,7 @@ where
|
|||
V: Collect,
|
||||
{
|
||||
#[inline]
|
||||
fn trace(&self, cc: CollectionContext) {
|
||||
fn trace(&self, cc: &gc_arena::Collection) {
|
||||
for (key, value) in self.0.iter() {
|
||||
key.trace(cc);
|
||||
for (ns, v) in value.iter() {
|
||||
|
|
|
@ -126,7 +126,7 @@ impl<'gc> ScopeChain<'gc> {
|
|||
let mut cloned = container.read().scopes.clone();
|
||||
cloned.extend_from_slice(new_scopes);
|
||||
Self {
|
||||
container: Some(GcCell::allocate(mc, ScopeContainer::new(cloned))),
|
||||
container: Some(GcCell::new(mc, ScopeContainer::new(cloned))),
|
||||
domain: self.domain,
|
||||
}
|
||||
}
|
||||
|
@ -134,10 +134,7 @@ impl<'gc> ScopeChain<'gc> {
|
|||
// We are chaining on top of an empty ScopeChain, so we don't actually
|
||||
// need to chain anything.
|
||||
Self {
|
||||
container: Some(GcCell::allocate(
|
||||
mc,
|
||||
ScopeContainer::new(new_scopes.to_vec()),
|
||||
)),
|
||||
container: Some(GcCell::new(mc, ScopeContainer::new(new_scopes.to_vec()))),
|
||||
domain: self.domain,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ impl<'gc> TranslationUnit<'gc> {
|
|||
let namespaces = vec![None; abc.constant_pool.namespaces.len() + 1];
|
||||
let multinames = vec![None; abc.constant_pool.multinames.len() + 1];
|
||||
|
||||
Self(GcCell::allocate(
|
||||
Self(GcCell::new(
|
||||
mc,
|
||||
TranslationUnitData {
|
||||
domain,
|
||||
|
@ -160,7 +160,7 @@ impl<'gc> TranslationUnit<'gc> {
|
|||
);
|
||||
}
|
||||
}
|
||||
Gc::allocate(activation.context.gc_context, bc_method).into()
|
||||
Gc::new(activation.context.gc_context, bc_method).into()
|
||||
})();
|
||||
|
||||
self.0.write(activation.context.gc_context).methods[method_index.0 as usize] =
|
||||
|
@ -317,7 +317,7 @@ impl<'gc> TranslationUnit<'gc> {
|
|||
drop(read);
|
||||
|
||||
let multiname = Multiname::from_abc_index(self, multiname_index, context)?;
|
||||
let multiname = Gc::allocate(mc, multiname);
|
||||
let multiname = Gc::new(mc, multiname);
|
||||
self.0.write(mc).multinames[multiname_index.0 as usize] = Some(multiname);
|
||||
|
||||
Ok(multiname)
|
||||
|
@ -351,7 +351,7 @@ impl<'gc> TranslationUnit<'gc> {
|
|||
) -> Result<Gc<'gc, Multiname<'gc>>, Error<'gc>> {
|
||||
if multiname_index.0 == 0 {
|
||||
let mc = context.gc_context;
|
||||
Ok(Gc::allocate(mc, Multiname::any(mc)))
|
||||
Ok(Gc::new(mc, Multiname::any(mc)))
|
||||
} else {
|
||||
self.pool_multiname_static(multiname_index, context)
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ impl<'gc> Script<'gc> {
|
|||
globals: Object<'gc>,
|
||||
domain: Domain<'gc>,
|
||||
) -> Self {
|
||||
Self(GcCell::allocate(
|
||||
Self(GcCell::new(
|
||||
mc,
|
||||
ScriptData {
|
||||
globals,
|
||||
|
@ -447,7 +447,7 @@ impl<'gc> Script<'gc> {
|
|||
|
||||
let init = unit.load_method(script.init_method, false, activation)?;
|
||||
|
||||
Ok(Self(GcCell::allocate(
|
||||
Ok(Self(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
ScriptData {
|
||||
globals,
|
||||
|
|
|
@ -54,7 +54,7 @@ pub struct ClassBoundMethod<'gc> {
|
|||
|
||||
impl<'gc> VTable<'gc> {
|
||||
pub fn empty(mc: MutationContext<'gc, '_>) -> Self {
|
||||
VTable(GcCell::allocate(
|
||||
VTable(GcCell::new(
|
||||
mc,
|
||||
VTableData {
|
||||
defining_class: None,
|
||||
|
@ -74,7 +74,7 @@ impl<'gc> VTable<'gc> {
|
|||
|
||||
rt.insert(*vname, Property::Slot { slot_id: 1 });
|
||||
|
||||
let vt = VTable(GcCell::allocate(
|
||||
let vt = VTable(GcCell::new(
|
||||
mc,
|
||||
VTableData {
|
||||
defining_class: None,
|
||||
|
@ -95,7 +95,7 @@ impl<'gc> VTable<'gc> {
|
|||
}
|
||||
|
||||
pub fn duplicate(self, mc: MutationContext<'gc, '_>) -> Self {
|
||||
VTable(GcCell::allocate(mc, self.0.read().clone()))
|
||||
VTable(GcCell::new(mc, self.0.read().clone()))
|
||||
}
|
||||
|
||||
pub fn resolved_traits(&self) -> Ref<'_, PropertyMap<'gc, Property>> {
|
||||
|
|
|
@ -289,7 +289,7 @@ mod wrapper {
|
|||
// Marking it as disposed skips rendering, and the unset `avm2_object` will cause this to
|
||||
// be inaccessible to AS3 code.
|
||||
pub fn dummy(mc: MutationContext<'gc, '_>) -> Self {
|
||||
BitmapDataWrapper(GcCell::allocate(
|
||||
BitmapDataWrapper(GcCell::new(
|
||||
mc,
|
||||
BitmapData {
|
||||
pixels: Vec::new(),
|
||||
|
|
|
@ -26,7 +26,7 @@ use crate::stub::StubCollection;
|
|||
use crate::tag_utils::{SwfMovie, SwfSlice};
|
||||
use crate::timer::Timers;
|
||||
use core::fmt;
|
||||
use gc_arena::{Collect, MutationContext};
|
||||
use gc_arena::{Collect, Mutation};
|
||||
use instant::Instant;
|
||||
use rand::rngs::SmallRng;
|
||||
use ruffle_render::backend::{BitmapCacheEntry, RenderBackend};
|
||||
|
@ -39,8 +39,8 @@ use std::time::Duration;
|
|||
|
||||
/// Minimal context, useful for manipulating the GC heap.
|
||||
pub struct GcContext<'a, 'gc> {
|
||||
/// The mutation context to allocate and mutate `GcCell` types.
|
||||
pub gc_context: MutationContext<'gc, 'a>,
|
||||
/// The mutation context to allocate and mutate `Gc` pointers.
|
||||
pub gc_context: &'gc Mutation<'gc>,
|
||||
|
||||
/// The global string interner.
|
||||
pub interner: &'a mut AvmStringInterner<'gc>,
|
||||
|
@ -57,6 +57,13 @@ impl<'a, 'gc> GcContext<'a, 'gc> {
|
|||
interner: self.interner,
|
||||
}
|
||||
}
|
||||
|
||||
/// Convenience method to retrieve the current GC context. Note that explicitely writing
|
||||
/// `self.gc_context` can be sometimes necessary to satisfy the borrow checker.
|
||||
#[inline(always)]
|
||||
pub fn gc(&self) -> &'gc Mutation<'gc> {
|
||||
self.gc_context
|
||||
}
|
||||
}
|
||||
|
||||
/// `UpdateContext` holds shared data that is used by the various subsystems of Ruffle.
|
||||
|
@ -67,8 +74,8 @@ pub struct UpdateContext<'a, 'gc> {
|
|||
/// Display objects and actions can push actions onto the queue.
|
||||
pub action_queue: &'a mut ActionQueue<'gc>,
|
||||
|
||||
/// The mutation context to allocate and mutate `GcCell` types.
|
||||
pub gc_context: MutationContext<'gc, 'a>,
|
||||
/// The mutation context to allocate and mutate `Gc` pointers.
|
||||
pub gc_context: &'gc Mutation<'gc>,
|
||||
|
||||
/// The global string interner.
|
||||
pub interner: &'a mut AvmStringInterner<'gc>,
|
||||
|
@ -317,6 +324,13 @@ impl<'a, 'gc> UpdateContext<'a, 'gc> {
|
|||
}
|
||||
|
||||
impl<'a, 'gc> UpdateContext<'a, 'gc> {
|
||||
/// Convenience method to retrieve the current GC context. Note that explicitely writing
|
||||
/// `self.gc_context` can be sometimes necessary to satisfy the borrow checker.
|
||||
#[inline(always)]
|
||||
pub fn gc(&self) -> &'gc Mutation<'gc> {
|
||||
self.gc_context
|
||||
}
|
||||
|
||||
/// Transform a borrowed update context into an owned update context with
|
||||
/// a shorter internal lifetime.
|
||||
///
|
||||
|
@ -469,6 +483,9 @@ impl<'gc> Default for ActionQueue<'gc> {
|
|||
|
||||
/// Shared data used during rendering.
|
||||
/// `Player` creates this when it renders a frame and passes it down to display objects.
|
||||
///
|
||||
/// As a convenience, this type can be deref-coerced to `Mutation<'gc>`, but note that explicitely
|
||||
/// writing `context.gc_context` can be sometimes necessary to satisfy the borrow checker.
|
||||
pub struct RenderContext<'a, 'gc> {
|
||||
/// The renderer, used by the display objects to register themselves.
|
||||
pub renderer: &'a mut dyn RenderBackend,
|
||||
|
@ -479,9 +496,8 @@ pub struct RenderContext<'a, 'gc> {
|
|||
/// Any offscreen draws that should be used to redraw a cacheAsBitmap
|
||||
pub cache_draws: &'a mut Vec<BitmapCacheEntry>,
|
||||
|
||||
/// The GC MutationContext, used to perform any GcCell writes
|
||||
/// that must occur during rendering.
|
||||
pub gc_context: MutationContext<'gc, 'a>,
|
||||
/// The GC context, used to perform any `Gc` writes that must occur during rendering.
|
||||
pub gc_context: &'gc Mutation<'gc>,
|
||||
|
||||
/// The library, which provides access to fonts and other definitions when rendering.
|
||||
pub library: &'a Library<'gc>,
|
||||
|
@ -499,6 +515,15 @@ pub struct RenderContext<'a, 'gc> {
|
|||
pub stage: Stage<'gc>,
|
||||
}
|
||||
|
||||
impl<'a, 'gc> RenderContext<'a, 'gc> {
|
||||
/// Convenience method to retrieve the current GC context. Note that explicitely writing
|
||||
/// `self.gc_context` can be sometimes necessary to satisfy the borrow checker.
|
||||
#[inline(always)]
|
||||
pub fn gc(&self) -> &'gc Mutation<'gc> {
|
||||
self.gc_context
|
||||
}
|
||||
}
|
||||
|
||||
/// The type of action being run.
|
||||
#[derive(Clone, Collect)]
|
||||
#[collect(no_drop)]
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::hash::{Hash, Hasher};
|
|||
// TODO: Make this generic somehow
|
||||
#[derive(Clone)]
|
||||
pub struct DisplayObjectHandle {
|
||||
root: DynamicRoot<Rootable![DisplayObject<'gc>]>,
|
||||
root: DynamicRoot<Rootable![DisplayObject<'_>]>,
|
||||
ptr: *const DisplayObjectPtr,
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ impl Eq for DisplayObjectHandle {}
|
|||
|
||||
#[derive(Clone)]
|
||||
pub struct AVM1ObjectHandle {
|
||||
root: DynamicRoot<Rootable![crate::avm1::Object<'gc>]>,
|
||||
root: DynamicRoot<Rootable![crate::avm1::Object<'_>]>,
|
||||
ptr: *const crate::avm1::ObjectPtr,
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ impl Eq for AVM1ObjectHandle {}
|
|||
|
||||
#[derive(Clone)]
|
||||
pub struct AVM2ObjectHandle {
|
||||
root: DynamicRoot<Rootable![crate::avm2::Object<'gc>]>,
|
||||
root: DynamicRoot<Rootable![crate::avm2::Object<'_>]>,
|
||||
ptr: *const crate::avm2::object::ObjectPtr,
|
||||
}
|
||||
|
||||
|
|
|
@ -73,11 +73,11 @@ impl<'gc> Avm1Button<'gc> {
|
|||
over_to_up_sound: None,
|
||||
};
|
||||
|
||||
Avm1Button(GcCell::allocate(
|
||||
Avm1Button(GcCell::new(
|
||||
gc_context,
|
||||
Avm1ButtonData {
|
||||
base: Default::default(),
|
||||
static_data: GcCell::allocate(gc_context, static_data),
|
||||
static_data: GcCell::new(gc_context, static_data),
|
||||
container: ChildContainer::new(),
|
||||
hit_area: BTreeMap::new(),
|
||||
state: self::ButtonState::Up,
|
||||
|
@ -246,7 +246,7 @@ impl<'gc> TDisplayObject<'gc> for Avm1Button<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
|
|
@ -110,11 +110,11 @@ impl<'gc> Avm2Button<'gc> {
|
|||
over_to_up_sound: None,
|
||||
};
|
||||
|
||||
Avm2Button(GcCell::allocate(
|
||||
Avm2Button(GcCell::new(
|
||||
context.gc_context,
|
||||
Avm2ButtonData {
|
||||
base: Default::default(),
|
||||
static_data: GcCell::allocate(context.gc_context, static_data),
|
||||
static_data: GcCell::new(context.gc_context, static_data),
|
||||
state: self::ButtonState::Up,
|
||||
hit_area: None,
|
||||
up_state: None,
|
||||
|
@ -411,7 +411,7 @@ impl<'gc> TDisplayObject<'gc> for Avm2Button<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
|
|
@ -112,7 +112,7 @@ impl<'gc> Bitmap<'gc> {
|
|||
let width = bitmap_data.width();
|
||||
let height = bitmap_data.height();
|
||||
|
||||
Bitmap(GcCell::allocate(
|
||||
Bitmap(GcCell::new(
|
||||
context.gc_context,
|
||||
BitmapGraphicData {
|
||||
base: Default::default(),
|
||||
|
@ -153,7 +153,7 @@ impl<'gc> Bitmap<'gc> {
|
|||
Ok(Self::new_with_bitmap_data(
|
||||
context,
|
||||
id,
|
||||
BitmapDataWrapper::new(GcCell::allocate(context.gc_context, bitmap_data)),
|
||||
BitmapDataWrapper::new(GcCell::new(context.gc_context, bitmap_data)),
|
||||
smoothing,
|
||||
))
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ impl<'gc> TDisplayObject<'gc> for Bitmap<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
|
|
@ -250,12 +250,12 @@ impl<'gc> EditText<'gc> {
|
|||
flags.contains(EditTextFlag::BORDER),
|
||||
);
|
||||
|
||||
let et = EditText(GcCell::allocate(
|
||||
let et = EditText(GcCell::new(
|
||||
context.gc_context,
|
||||
EditTextData {
|
||||
base,
|
||||
text_spans,
|
||||
static_data: gc_arena::Gc::allocate(
|
||||
static_data: gc_arena::Gc::new(
|
||||
context.gc_context,
|
||||
EditTextStatic {
|
||||
swf: swf_movie,
|
||||
|
@ -1586,7 +1586,7 @@ impl<'gc> TDisplayObject<'gc> for EditText<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
|
|
@ -59,11 +59,11 @@ impl<'gc> Graphic<'gc> {
|
|||
movie,
|
||||
};
|
||||
|
||||
Graphic(GcCell::allocate(
|
||||
Graphic(GcCell::new(
|
||||
context.gc_context,
|
||||
GraphicData {
|
||||
base: Default::default(),
|
||||
static_data: gc_arena::Gc::allocate(context.gc_context, static_data),
|
||||
static_data: gc_arena::Gc::new(context.gc_context, static_data),
|
||||
avm2_object: None,
|
||||
drawing: None,
|
||||
},
|
||||
|
@ -92,11 +92,11 @@ impl<'gc> Graphic<'gc> {
|
|||
};
|
||||
let drawing = Drawing::new();
|
||||
|
||||
Graphic(GcCell::allocate(
|
||||
Graphic(GcCell::new(
|
||||
context.gc_context,
|
||||
GraphicData {
|
||||
base: Default::default(),
|
||||
static_data: gc_arena::Gc::allocate(context.gc_context, static_data),
|
||||
static_data: gc_arena::Gc::new(context.gc_context, static_data),
|
||||
avm2_object: None,
|
||||
drawing: Some(drawing),
|
||||
},
|
||||
|
@ -120,7 +120,7 @@ impl<'gc> TDisplayObject<'gc> for Graphic<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
|
|
@ -42,7 +42,7 @@ pub struct LoaderDisplayData<'gc> {
|
|||
|
||||
impl<'gc> LoaderDisplay<'gc> {
|
||||
pub fn empty(activation: &mut Activation<'_, 'gc>, movie: Arc<SwfMovie>) -> Self {
|
||||
let obj = LoaderDisplay(GcCell::allocate(
|
||||
let obj = LoaderDisplay(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
LoaderDisplayData {
|
||||
base: Default::default(),
|
||||
|
@ -72,7 +72,7 @@ impl<'gc> TDisplayObject<'gc> for LoaderDisplay<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
|
|
@ -43,11 +43,11 @@ impl<'gc> MorphShape<'gc> {
|
|||
movie: Arc<SwfMovie>,
|
||||
) -> Self {
|
||||
let static_data = MorphShapeStatic::from_swf_tag(&tag, movie);
|
||||
MorphShape(GcCell::allocate(
|
||||
MorphShape(GcCell::new(
|
||||
gc_context,
|
||||
MorphShapeData {
|
||||
base: Default::default(),
|
||||
static_data: Gc::allocate(gc_context, static_data),
|
||||
static_data: Gc::new(gc_context, static_data),
|
||||
ratio: 0,
|
||||
object: None,
|
||||
},
|
||||
|
@ -74,7 +74,7 @@ impl<'gc> TDisplayObject<'gc> for MorphShape<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
|
|
@ -137,11 +137,11 @@ pub struct MovieClipData<'gc> {
|
|||
|
||||
impl<'gc> MovieClip<'gc> {
|
||||
pub fn new(movie: Arc<SwfMovie>, gc_context: MutationContext<'gc, '_>) -> Self {
|
||||
MovieClip(GcCell::allocate(
|
||||
MovieClip(GcCell::new(
|
||||
gc_context,
|
||||
MovieClipData {
|
||||
base: Default::default(),
|
||||
static_data: Gc::allocate(gc_context, MovieClipStatic::empty(movie, gc_context)),
|
||||
static_data: Gc::new(gc_context, MovieClipStatic::empty(movie, gc_context)),
|
||||
tag_stream_pos: 0,
|
||||
current_frame: 0,
|
||||
audio_stream: None,
|
||||
|
@ -176,11 +176,11 @@ impl<'gc> MovieClip<'gc> {
|
|||
class: Avm2ClassObject<'gc>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
) -> Self {
|
||||
MovieClip(GcCell::allocate(
|
||||
MovieClip(GcCell::new(
|
||||
gc_context,
|
||||
MovieClipData {
|
||||
base: Default::default(),
|
||||
static_data: Gc::allocate(gc_context, MovieClipStatic::empty(movie, gc_context)),
|
||||
static_data: Gc::new(gc_context, MovieClipStatic::empty(movie, gc_context)),
|
||||
tag_stream_pos: 0,
|
||||
current_frame: 0,
|
||||
audio_stream: None,
|
||||
|
@ -216,11 +216,11 @@ impl<'gc> MovieClip<'gc> {
|
|||
swf: SwfSlice,
|
||||
num_frames: u16,
|
||||
) -> Self {
|
||||
MovieClip(GcCell::allocate(
|
||||
MovieClip(GcCell::new(
|
||||
gc_context,
|
||||
MovieClipData {
|
||||
base: Default::default(),
|
||||
static_data: Gc::allocate(
|
||||
static_data: Gc::new(
|
||||
gc_context,
|
||||
MovieClipStatic::with_data(id, swf, num_frames, None, gc_context),
|
||||
),
|
||||
|
@ -275,11 +275,11 @@ impl<'gc> MovieClip<'gc> {
|
|||
None
|
||||
};
|
||||
|
||||
let mc = MovieClip(GcCell::allocate(
|
||||
let mc = MovieClip(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
MovieClipData {
|
||||
base: Default::default(),
|
||||
static_data: Gc::allocate(
|
||||
static_data: Gc::new(
|
||||
activation.context.gc_context,
|
||||
MovieClipStatic::with_data(
|
||||
0,
|
||||
|
@ -357,7 +357,7 @@ impl<'gc> MovieClip<'gc> {
|
|||
);
|
||||
|
||||
mc.base.base.reset_for_movie_load();
|
||||
mc.static_data = Gc::allocate(
|
||||
mc.static_data = Gc::new(
|
||||
context.gc_context,
|
||||
MovieClipStatic::with_data(
|
||||
0,
|
||||
|
@ -682,8 +682,7 @@ impl<'gc> MovieClip<'gc> {
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
self.0.write(context.gc_context).static_data =
|
||||
Gc::allocate(context.gc_context, static_data);
|
||||
self.0.write(context.gc_context).static_data = Gc::new(context.gc_context, static_data);
|
||||
|
||||
is_finished
|
||||
}
|
||||
|
@ -2361,7 +2360,7 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
@ -4277,9 +4276,9 @@ impl<'gc> MovieClipStatic<'gc> {
|
|||
scene_labels_map: HashMap::new(),
|
||||
audio_stream_info: None,
|
||||
audio_stream_handle: None,
|
||||
exported_name: GcCell::allocate(gc_context, None),
|
||||
exported_name: GcCell::new(gc_context, None),
|
||||
loader_info,
|
||||
preload_progress: GcCell::allocate(gc_context, Default::default()),
|
||||
preload_progress: GcCell::new(gc_context, Default::default()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ impl<'gc> Stage<'gc> {
|
|||
fullscreen: bool,
|
||||
movie: Arc<SwfMovie>,
|
||||
) -> Stage<'gc> {
|
||||
let stage = Self(GcCell::allocate(
|
||||
let stage = Self(GcCell::new(
|
||||
gc_context,
|
||||
StageData {
|
||||
base: Default::default(),
|
||||
|
@ -732,7 +732,7 @@ impl<'gc> TDisplayObject<'gc> for Stage<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
|
|
@ -41,11 +41,11 @@ impl<'gc> Text<'gc> {
|
|||
swf: Arc<SwfMovie>,
|
||||
tag: &swf::Text,
|
||||
) -> Self {
|
||||
Text(GcCell::allocate(
|
||||
Text(GcCell::new(
|
||||
context.gc_context,
|
||||
TextData {
|
||||
base: Default::default(),
|
||||
static_data: gc_arena::Gc::allocate(
|
||||
static_data: gc_arena::Gc::new(
|
||||
context.gc_context,
|
||||
TextStatic {
|
||||
swf,
|
||||
|
@ -81,7 +81,7 @@ impl<'gc> TDisplayObject<'gc> for Text<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
|
|
@ -130,7 +130,7 @@ impl<'gc> Video<'gc> {
|
|||
mc: MutationContext<'gc, '_>,
|
||||
) -> Self {
|
||||
let size = (streamdef.width.into(), streamdef.height.into());
|
||||
let source = GcCell::allocate(
|
||||
let source = GcCell::new(
|
||||
mc,
|
||||
VideoSource::Swf {
|
||||
streamdef,
|
||||
|
@ -138,7 +138,7 @@ impl<'gc> Video<'gc> {
|
|||
},
|
||||
);
|
||||
|
||||
Video(GcCell::allocate(
|
||||
Video(GcCell::new(
|
||||
mc,
|
||||
VideoData {
|
||||
base: Default::default(),
|
||||
|
@ -160,9 +160,9 @@ impl<'gc> Video<'gc> {
|
|||
height: i32,
|
||||
object: Option<AvmObject<'gc>>,
|
||||
) -> Self {
|
||||
let source = GcCell::allocate(mc, VideoSource::Unconnected);
|
||||
let source = GcCell::new(mc, VideoSource::Unconnected);
|
||||
|
||||
Video(GcCell::allocate(
|
||||
Video(GcCell::new(
|
||||
mc,
|
||||
VideoData {
|
||||
base: Default::default(),
|
||||
|
@ -187,7 +187,7 @@ impl<'gc> Video<'gc> {
|
|||
pub fn attach_netstream(self, context: &mut UpdateContext<'_, 'gc>, stream: NetStream<'gc>) {
|
||||
let mut video = self.0.write(context.gc_context);
|
||||
|
||||
video.source = GcCell::allocate(context.gc_context, VideoSource::NetStream { stream });
|
||||
video.source = GcCell::new(context.gc_context, VideoSource::NetStream { stream });
|
||||
video.stream = VideoStream::Uninstantiated(0);
|
||||
video.keyframes = BTreeSet::new();
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ impl<'gc> TDisplayObject<'gc> for Video<'gc> {
|
|||
}
|
||||
|
||||
fn instantiate(&self, gc_context: MutationContext<'gc, '_>) -> DisplayObject<'gc> {
|
||||
Self(GcCell::allocate(gc_context, self.0.read().clone())).into()
|
||||
Self(GcCell::new(gc_context, self.0.read().clone())).into()
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const DisplayObjectPtr {
|
||||
|
|
|
@ -12,7 +12,7 @@ pub struct FocusTracker<'gc>(GcCell<'gc, Option<DisplayObject<'gc>>>);
|
|||
|
||||
impl<'gc> FocusTracker<'gc> {
|
||||
pub fn new(gc_context: MutationContext<'gc, '_>) -> Self {
|
||||
Self(GcCell::allocate(gc_context, None))
|
||||
Self(GcCell::new(gc_context, None))
|
||||
}
|
||||
|
||||
pub fn get(&self) -> Option<DisplayObject<'gc>> {
|
||||
|
|
|
@ -149,7 +149,7 @@ impl<'gc> Font<'gc> {
|
|||
fnv::FnvHashMap::default()
|
||||
};
|
||||
|
||||
Font(Gc::allocate(
|
||||
Font(Gc::new(
|
||||
gc_context,
|
||||
FontData {
|
||||
glyphs,
|
||||
|
|
|
@ -49,7 +49,7 @@ pub struct Avm2ClassRegistry<'gc> {
|
|||
}
|
||||
|
||||
unsafe impl Collect for Avm2ClassRegistry<'_> {
|
||||
fn trace(&self, cc: gc_arena::CollectionContext) {
|
||||
fn trace(&self, cc: &gc_arena::Collection) {
|
||||
for (k, _) in self.class_map.iter() {
|
||||
k.trace(cc);
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ pub struct Library<'gc> {
|
|||
|
||||
unsafe impl<'gc> gc_arena::Collect for Library<'gc> {
|
||||
#[inline]
|
||||
fn trace(&self, cc: gc_arena::CollectionContext) {
|
||||
fn trace(&self, cc: &gc_arena::Collection) {
|
||||
for (_, val) in self.movie_libraries.iter() {
|
||||
val.trace(cc);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ use crate::string::AvmString;
|
|||
use crate::tag_utils::SwfMovie;
|
||||
use crate::vminterface::Instantiator;
|
||||
use encoding_rs::UTF_8;
|
||||
use gc_arena::{Collect, CollectionContext, GcCell};
|
||||
use gc_arena::{Collect, GcCell};
|
||||
use generational_arena::{Arena, Index};
|
||||
use ruffle_render::utils::{determine_jpeg_tag_format, JpegTagFormat};
|
||||
use std::fmt;
|
||||
|
@ -192,7 +192,7 @@ impl From<crate::avm1::Error<'_>> for Error {
|
|||
pub struct LoadManager<'gc>(Arena<Loader<'gc>>);
|
||||
|
||||
unsafe impl<'gc> Collect for LoadManager<'gc> {
|
||||
fn trace(&self, cc: CollectionContext) {
|
||||
fn trace(&self, cc: &gc_arena::Collection) {
|
||||
for (_, loader) in self.0.iter() {
|
||||
loader.trace(cc)
|
||||
}
|
||||
|
@ -1573,7 +1573,7 @@ impl<'gc> Loader<'gc> {
|
|||
transparency,
|
||||
bitmap.as_colors().map(Color::from).collect(),
|
||||
);
|
||||
let bitmapdata_wrapper = BitmapDataWrapper::new(GcCell::allocate(
|
||||
let bitmapdata_wrapper = BitmapDataWrapper::new(GcCell::new(
|
||||
activation.context.gc_context,
|
||||
bitmap_data,
|
||||
));
|
||||
|
|
|
@ -46,8 +46,7 @@ use crate::stub::StubCollection;
|
|||
use crate::tag_utils::SwfMovie;
|
||||
use crate::timer::Timers;
|
||||
use crate::vminterface::Instantiator;
|
||||
use gc_arena::{ArenaParameters, Collect, DynamicRootSet, GcCell};
|
||||
use gc_arena::{MutationContext, Rootable};
|
||||
use gc_arena::{ArenaParameters, Collect, DynamicRootSet, GcCell, Rootable};
|
||||
use instant::Instant;
|
||||
use rand::{rngs::SmallRng, SeedableRng};
|
||||
use ruffle_render::backend::{null::NullRenderer, RenderBackend, ViewportDimensions};
|
||||
|
@ -212,7 +211,7 @@ impl<'gc> GcRootData<'gc> {
|
|||
}
|
||||
}
|
||||
|
||||
type GcArena = gc_arena::Arena<Rootable![GcRoot<'gc>]>;
|
||||
type GcArena = gc_arena::Arena<Rootable![GcRoot<'_>]>;
|
||||
|
||||
type Audio = Box<dyn AudioBackend>;
|
||||
type Navigator = Box<dyn NavigatorBackend>;
|
||||
|
@ -1849,7 +1848,7 @@ impl Player {
|
|||
}
|
||||
|
||||
pub fn load_device_font<'gc>(
|
||||
gc_context: gc_arena::MutationContext<'gc, '_>,
|
||||
gc_context: &'gc gc_arena::Mutation<'gc>,
|
||||
renderer: &mut dyn RenderBackend,
|
||||
) -> Font<'gc> {
|
||||
const DEVICE_FONT_TAG: &[u8] = include_bytes!("../assets/noto-sans-definefont3.bin");
|
||||
|
@ -2249,7 +2248,7 @@ impl PlayerBuilder {
|
|||
}
|
||||
|
||||
fn create_gc_root<'gc>(
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
gc_context: &'gc gc_arena::Mutation<'gc>,
|
||||
player_version: u8,
|
||||
fullscreen: bool,
|
||||
fake_movie: Arc<SwfMovie>,
|
||||
|
@ -2263,8 +2262,8 @@ impl PlayerBuilder {
|
|||
let dynamic_root = DynamicRootSet::new(gc_context);
|
||||
|
||||
GcRoot {
|
||||
callstack: GcCell::allocate(gc_context, GcCallstack::default()),
|
||||
data: GcCell::allocate(
|
||||
callstack: GcCell::new(gc_context, GcCallstack::default()),
|
||||
data: GcCell::new(
|
||||
gc_context,
|
||||
GcRootData {
|
||||
audio_manager: AudioManager::new(),
|
||||
|
|
|
@ -186,7 +186,7 @@ pub struct NetStreamData<'gc> {
|
|||
|
||||
impl<'gc> NetStream<'gc> {
|
||||
pub fn new(gc_context: MutationContext<'gc, '_>, avm_object: Option<AvmObject<'gc>>) -> Self {
|
||||
Self(GcCell::allocate(
|
||||
Self(GcCell::new(
|
||||
gc_context,
|
||||
NetStreamData {
|
||||
buffer: Arc::new(Mutex::new(Vec::new())),
|
||||
|
|
|
@ -25,7 +25,7 @@ impl<'gc> AvmString<'gc> {
|
|||
Source::Owned(s) => s,
|
||||
Source::Static(s) => {
|
||||
let repr = AvmStringRepr::from_raw(s.into(), false);
|
||||
Gc::allocate(gc_context, repr)
|
||||
Gc::new(gc_context, repr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ impl<'gc> AvmString<'gc> {
|
|||
};
|
||||
let repr = AvmStringRepr::from_raw(buf, false);
|
||||
Self {
|
||||
source: Source::Owned(Gc::allocate(gc_context, repr)),
|
||||
source: Source::Owned(Gc::new(gc_context, repr)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ impl<'gc> AvmString<'gc> {
|
|||
pub fn new<S: Into<WString>>(gc_context: MutationContext<'gc, '_>, string: S) -> Self {
|
||||
let repr = AvmStringRepr::from_raw(string.into(), false);
|
||||
Self {
|
||||
source: Source::Owned(Gc::allocate(gc_context, repr)),
|
||||
source: Source::Owned(Gc::new(gc_context, repr)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::hash::{BuildHasher, Hash, Hasher};
|
|||
use std::marker::PhantomData;
|
||||
use std::ops::DerefMut;
|
||||
|
||||
use gc_arena::{Collect, CollectionContext, Gc, GcWeak, MutationContext};
|
||||
use gc_arena::{Collect, Gc, GcWeak, MutationContext};
|
||||
use hashbrown::HashSet;
|
||||
|
||||
use crate::string::{AvmString, AvmStringRepr, WStr};
|
||||
|
@ -60,7 +60,7 @@ impl<'gc> AvmStringInterner<'gc> {
|
|||
|
||||
fn alloc(mc: MutationContext<'gc, '_>, s: Cow<'_, WStr>) -> Gc<'gc, AvmStringRepr> {
|
||||
let repr = AvmStringRepr::from_raw(s.into_owned(), true);
|
||||
Gc::allocate(mc, repr)
|
||||
Gc::new(mc, repr)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
|
@ -220,7 +220,7 @@ impl<'gc, T: Hash + 'gc> WeakSet<'gc, T> {
|
|||
}
|
||||
|
||||
unsafe impl<'gc, T> Collect for WeakSet<'gc, T> {
|
||||
fn trace(&self, cc: CollectionContext) {
|
||||
fn trace(&self, cc: &gc_arena::Collection) {
|
||||
// Prune entries known to be dead.
|
||||
// Safe, as we never pick up new GC pointers from outside this allocation.
|
||||
let mut guard = unsafe { self.table.steal_for_trace() };
|
||||
|
@ -256,12 +256,12 @@ impl<'gc, T> CollectCell<'gc, T> {
|
|||
|
||||
/// SAFETY: must be called inside a `Collect::trace` function.
|
||||
///
|
||||
/// An alternative would be to require a `CollectionContext` argument, but this is
|
||||
/// An alternative would be to require a `&gc_arena::Collection` argument, but this is
|
||||
/// still unsound in presence of nested arenas (preventing this would require a `'gc`
|
||||
/// lifetime on `CollectionContext` and `Collect`):
|
||||
/// lifetime on `&gc_arena::Collection` and `Collect`):
|
||||
///
|
||||
/// ```rs,ignore
|
||||
/// fn trace(&self, cc: CollectionContext) {
|
||||
/// fn trace(&self, cc: &gc_arena::Collection) {
|
||||
/// rootless_arena(|mc| {
|
||||
/// let cell = CollectCell::<i32>::default();
|
||||
/// let borrow: &i32 = dbg!(cell.as_ref(mc)); // 0
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue