4
4
5
5
//! Rust wrappers around the raw JS apis
6
6
7
- use libc:: { size_t, c_uint, c_char, ptrdiff_t } ;
7
+ use libc:: { size_t, c_uint, c_char} ;
8
8
use heapsize:: HeapSizeOf ;
9
9
use std:: char;
10
10
use std:: ffi;
@@ -26,7 +26,6 @@ use jsapi::{JS_SetErrorReporter, Evaluate2, JSErrorReport};
26
26
use jsapi:: { JS_SetGCParameter , JSGCParamKey } ;
27
27
use jsapi:: { Heap , HeapObjectPostBarrier , HeapValuePostBarrier } ;
28
28
use jsapi:: { ContextFriendFields } ;
29
- use jsapi:: { CustomAutoRooter , AutoGCRooter , _vftable_CustomAutoRooter, AutoGCRooter_jspubtd_h_unnamed_1 } ;
30
29
use jsapi:: { Rooted , Handle , MutableHandle , MutableHandleBase , RootedBase } ;
31
30
use jsapi:: { MutableHandleValue , HandleValue , HandleObject , HandleBase } ;
32
31
use jsapi:: AutoObjectVector ;
@@ -403,45 +402,6 @@ impl<T> Drop for Rooted<T> {
403
402
}
404
403
}
405
404
406
- impl CustomAutoRooter {
407
- pub fn new ( cx : * mut JSContext , vftable : & ' static _vftable_CustomAutoRooter )
408
- -> CustomAutoRooter {
409
- CustomAutoRooter :: new_with_addr ( cx, vftable, unsafe { return_address ( ) } )
410
- }
411
-
412
- pub fn new_with_addr ( cx : * mut JSContext , vftable : & ' static _vftable_CustomAutoRooter , addr : * const u8 ) -> CustomAutoRooter {
413
- let ctxfriend: & mut ContextFriendFields = unsafe {
414
- & mut * ( cx as * mut ContextFriendFields )
415
- } ;
416
-
417
- let rooter = CustomAutoRooter {
418
- _vftable : vftable as * const _ ,
419
- _base : AutoGCRooter {
420
- down : ctxfriend. roots . autoGCRooters_ ,
421
- tag_ : AutoGCRooter_jspubtd_h_unnamed_1 :: CUSTOM as ptrdiff_t ,
422
- stackTop : & mut ctxfriend. roots . autoGCRooters_ as * mut _ ,
423
- }
424
- } ;
425
-
426
- ctxfriend. roots . autoGCRooters_ = unsafe {
427
- ( addr as * const * const u8 ) . offset ( 1 ) as * const AutoGCRooter as * mut _
428
- } ;
429
- rooter
430
- }
431
- }
432
-
433
- impl Drop for CustomAutoRooter {
434
- fn drop ( & mut self ) {
435
- if self . _base . stackTop as usize == mem:: POST_DROP_USIZE {
436
- return ;
437
- }
438
- unsafe {
439
- assert ! ( * self . _base. stackTop == mem:: transmute( & self . _base) ) ;
440
- * self . _base . stackTop = self . _base . down ;
441
- }
442
- }
443
- }
444
-
445
405
impl Default for jsid {
446
406
fn default ( ) -> jsid { JSID_VOID }
447
407
}
0 commit comments