fn estimate_realloc_capacity(&self) -> Option<usize> {
        let queue = self.microtask_queue.borrow();
        // A VecDeque retains a `2^n-1` capacity
        let half_cap = queue.capacity()/2;
        // We consider shrinking the queue if it is less than
        // half full...
        if half_cap > queue.len() && half_cap > INITIAL_QUEUE_CAPACITY {
            // ...and if it's been that way for at least
            // `QUEUE_SHRINK_DELAY` iterations.
            let shrink_counter = self.shrink_counter.get();
            if shrink_counter < QUEUE_SHRINK_DELAY {
                self.shrink_counter.set(shrink_counter + 1);
            } else {
                self.shrink_counter.set(0);
                return Some(cmp::max(queue.len(), INITIAL_QUEUE_CAPACITY));
            }
        } else {
            self.shrink_counter.set(0);
        }
        None
    }
// See if it's worth trying to reclaim some space from the queue
See if it's worth trying to reclaim some space from the queue
See if it ' s worth trying to reclaim some space from the queue
fn estimate_realloc_capacity(&self) -> Option<usize> {
        let queue = self.microtask_queue.borrow();
        // A VecDeque retains a `2^n-1` capacity
        let half_cap = queue.capacity()/2;
        // We consider shrinking the queue if it is less than
        // half full...
        if half_cap > queue.len() && half_cap > INITIAL_QUEUE_CAPACITY {
            // ...and if it's been that way for at least
            // `QUEUE_SHRINK_DELAY` iterations.
            let shrink_counter = self.shrink_counter.get();
            if shrink_counter < QUEUE_SHRINK_DELAY {
                self.shrink_counter.set(shrink_counter + 1);
            } else {
                self.shrink_counter.set(0);
                return Some(cmp::max(queue.len(), INITIAL_QUEUE_CAPACITY));
            }
        } else {
            self.shrink_counter.set(0);
        }
        None
    }
fn estimate_realloc_capacity ( & self ) -> Option < usize > { let queue = self . microtask_queue . borrow ( ) ; // A VecDeque retains a `2^n-1` capacity let half_cap = queue . capacity ( ) / 2 ; // We consider shrinking the queue if it is less than // half full... if half_cap > queue . len ( ) && half_cap > INITIAL_QUEUE_CAPACITY { // ...and if it's been that way for at least // `QUEUE_SHRINK_DELAY` iterations. let shrink_counter = self . shrink_counter . get ( ) ; if shrink_counter < QUEUE_SHRINK_DELAY { self . shrink_counter . set ( shrink_counter + 1 ) ; } else { self . shrink_counter . set ( 0 ) ; return Some ( cmp :: max ( queue . len ( ) , INITIAL_QUEUE_CAPACITY ) ) ; } } else { self . shrink_counter . set ( 0 ) ; } None }
See if it's worth trying to reclaim some space from the queue
See if it ' s worth trying to reclaim some space from the queue
&self
&self