mirror of
https://github.com/denoland/rusty_v8.git
synced 2025-01-12 17:09:28 -05:00
minor clean ups
This commit is contained in:
parent
0a256461e2
commit
517c213f1e
2 changed files with 6 additions and 2 deletions
|
@ -79,6 +79,7 @@ pub fn set_flags_from_command_line(args: Vec<String>) -> Vec<String> {
|
|||
.collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_set_flags_from_command_line() {
|
||||
let r = set_flags_from_command_line(vec![
|
||||
"binaryname".to_string(),
|
||||
|
@ -106,6 +107,8 @@ fn test_get_version() {
|
|||
// TODO: V8::InitializePlatform does not actually take a UniquePtr but rather
|
||||
// a raw pointer. This means that the Platform object is not released when
|
||||
// V8::ShutdownPlatform is called.
|
||||
/// Sets the v8::Platform to use. This should be invoked before V8 is
|
||||
/// initialized.
|
||||
pub fn initialize_platform(platform: UniquePtr<Platform>) {
|
||||
let mut global_state_guard = GLOBAL_STATE.lock().unwrap();
|
||||
assert_eq!(*global_state_guard, Uninitialized);
|
||||
|
@ -142,6 +145,8 @@ pub unsafe fn dispose() -> bool {
|
|||
true
|
||||
}
|
||||
|
||||
/// Clears all references to the v8::Platform. This should be invoked after
|
||||
/// V8 was disposed.
|
||||
pub fn shutdown_platform() {
|
||||
let mut global_state_guard = GLOBAL_STATE.lock().unwrap();
|
||||
assert_eq!(*global_state_guard, Disposed);
|
||||
|
|
|
@ -4,7 +4,6 @@ use crate::array_buffer::Allocator;
|
|||
use crate::support::Delete;
|
||||
use crate::support::Opaque;
|
||||
use crate::support::UniqueRef;
|
||||
use crate::V8::assert_initialized;
|
||||
|
||||
extern "C" {
|
||||
fn v8__Isolate__New(params: *mut CreateParams) -> &'static mut CxxIsolate;
|
||||
|
@ -31,7 +30,7 @@ pub struct Isolate(&'static mut CxxIsolate);
|
|||
impl Isolate {
|
||||
pub fn new(params: UniqueRef<CreateParams>) -> Self {
|
||||
// TODO: support CreateParams.
|
||||
assert_initialized();
|
||||
crate::V8::assert_initialized();
|
||||
Self(unsafe { v8__Isolate__New(params.into_raw()) })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue