avm2: minor changes to domain memory
* Do not use as_bytearray_mut when we don't need mutability * Set default domain memory size to 1024b.
This commit is contained in:
parent
9812fab9f8
commit
8176e0a633
|
@ -2613,7 +2613,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
|||
|
||||
let dm = self.domain_memory()?;
|
||||
let dm = dm
|
||||
.as_bytearray_mut(self.context.gc_context)
|
||||
.as_bytearray()
|
||||
.ok_or_else(|| "Unable to get bytearray storage".to_string())?;
|
||||
let val = dm.get(address);
|
||||
|
||||
|
@ -2632,7 +2632,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
|||
|
||||
let dm = self.domain_memory()?;
|
||||
let dm = dm
|
||||
.as_bytearray_mut(self.context.gc_context)
|
||||
.as_bytearray()
|
||||
.ok_or_else(|| "Unable to get bytearray storage".to_string())?;
|
||||
let val = dm.get_range(address..address + 2);
|
||||
|
||||
|
@ -2653,7 +2653,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
|||
|
||||
let dm = self.domain_memory()?;
|
||||
let dm = dm
|
||||
.as_bytearray_mut(self.context.gc_context)
|
||||
.as_bytearray()
|
||||
.ok_or_else(|| "Unable to get bytearray storage".to_string())?;
|
||||
let val = dm.get_range(address..address + 4);
|
||||
|
||||
|
@ -2674,7 +2674,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
|||
|
||||
let dm = self.domain_memory()?;
|
||||
let dm = dm
|
||||
.as_bytearray_mut(self.context.gc_context)
|
||||
.as_bytearray()
|
||||
.ok_or_else(|| "Unable to get bytearray storage".to_string())?;
|
||||
let val = dm.get_range(address..address + 4);
|
||||
|
||||
|
@ -2695,7 +2695,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
|||
|
||||
let dm = self.domain_memory()?;
|
||||
let dm = dm
|
||||
.as_bytearray_mut(self.context.gc_context)
|
||||
.as_bytearray()
|
||||
.ok_or_else(|| "Unable to get bytearray storage".to_string())?;
|
||||
let val = dm.get_range(address..address + 8);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ impl<'gc> Domain<'gc> {
|
|||
/// hence the name.
|
||||
pub fn global_domain(mc: MutationContext<'gc, '_>) -> Domain<'gc> {
|
||||
let domain_memory = ByteArrayObject::new(mc, None);
|
||||
domain_memory.as_bytearray_mut(mc).unwrap().set_length(100);
|
||||
domain_memory.as_bytearray_mut(mc).unwrap().set_length(1024);
|
||||
|
||||
Self(GcCell::allocate(
|
||||
mc,
|
||||
|
@ -50,7 +50,7 @@ impl<'gc> Domain<'gc> {
|
|||
/// Create a new domain with a given parent.
|
||||
pub fn movie_domain(mc: MutationContext<'gc, '_>, parent: Domain<'gc>) -> Domain<'gc> {
|
||||
let domain_memory = ByteArrayObject::new(mc, None);
|
||||
domain_memory.as_bytearray_mut(mc).unwrap().set_length(100);
|
||||
domain_memory.as_bytearray_mut(mc).unwrap().set_length(1024);
|
||||
|
||||
Self(GcCell::allocate(
|
||||
mc,
|
||||
|
|
Loading…
Reference in New Issue