Skip to content

Commit 02b123c

Browse files
prokopyldflemstr
authored andcommitted
Updated bindgen to version 0.22 (#16)
1 parent d218df9 commit 02b123c

File tree

13 files changed

+341
-343
lines changed

13 files changed

+341
-343
lines changed

src/allocator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub struct Allocator(v8::ArrayBuffer_AllocatorPtr);
1212
impl Allocator {
1313
/// Creates a new allocator.
1414
pub fn new() -> Allocator {
15-
let raw = unsafe { v8::ArrayBuffer_Allocator_Create(ALLOCATOR_FUNCTIONS) };
15+
let raw = unsafe { v8::v8_ArrayBuffer_Allocator_Create(ALLOCATOR_FUNCTIONS) };
1616
if raw.is_null() {
1717
panic!("Could not create ArrayBuffer::Allocator");
1818
}
@@ -29,12 +29,12 @@ impl Allocator {
2929
impl Drop for Allocator {
3030
fn drop(&mut self) {
3131
unsafe {
32-
v8::ArrayBuffer_Allocator_Destroy(self.0);
32+
v8::v8_ArrayBuffer_Allocator_Destroy(self.0);
3333
}
3434
}
3535
}
3636

37-
const ALLOCATOR_FUNCTIONS: v8::AllocatorFunctions = v8::AllocatorFunctions {
37+
const ALLOCATOR_FUNCTIONS: v8::v8_AllocatorFunctions = v8::v8_AllocatorFunctions {
3838
Allocate: Some(allocate),
3939
AllocateUninitialized: Some(allocate_uninitialized),
4040
Free: Some(free),

src/context.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl Context {
1717
pub fn new(isolate: &isolate::Isolate) -> Context {
1818
unsafe {
1919
Context(isolate.clone(),
20-
util::invoke(isolate, |c| v8::Context_New(c)).unwrap())
20+
util::invoke(isolate, |c| v8::v8_Context_New(c)).unwrap())
2121
}
2222
}
2323

@@ -30,11 +30,11 @@ impl Context {
3030
}
3131

3232
fn enter(&self) {
33-
unsafe { util::invoke(&self.0, |c| v8::Context_Enter(c, self.1)).unwrap() }
33+
unsafe { util::invoke(&self.0, |c| v8::v8_Context_Enter(c, self.1)).unwrap() }
3434
}
3535

3636
fn exit(&self) {
37-
unsafe { util::invoke(&self.0, |c| v8::Context_Exit(c, self.1)).unwrap() }
37+
unsafe { util::invoke(&self.0, |c| v8::v8_Context_Exit(c, self.1)).unwrap() }
3838
}
3939

4040
/// Returns the global proxy object.
@@ -49,7 +49,7 @@ impl Context {
4949
pub fn global(&self) -> value::Object {
5050
unsafe {
5151
value::Object::from_raw(&self.0,
52-
util::invoke(&self.0, |c| v8::Context_Global(c, self.1))
52+
util::invoke(&self.0, |c| v8::v8_Context_Global(c, self.1))
5353
.unwrap())
5454
}
5555
}
@@ -65,7 +65,7 @@ impl Context {
6565
}
6666
}
6767

68-
reference!(Context, v8::Context_CloneRef, v8::Context_DestroyRef);
68+
reference!(Context, v8::v8_Context_CloneRef, v8::v8_Context_DestroyRef);
6969

7070
impl<'a> Drop for ContextGuard<'a> {
7171
fn drop(&mut self) {

src/error.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ impl Message {
5555
value::String::from_raw(&self.0,
5656
util::invoke_ctx(&self.0,
5757
context,
58-
|c| v8::Message_Get(c, self.1))
58+
|c| v8::v8_Message_Get(c, self.1))
5959
.unwrap())
6060
}
6161
}
6262

6363
/// The stack trace to the point where the error was generated.
6464
pub fn get_stack_trace(&self) -> StackTrace {
6565
let raw =
66-
unsafe { util::invoke(&self.0, |c| v8::Message_GetStackTrace(c, self.1)).unwrap() };
66+
unsafe { util::invoke(&self.0, |c| v8::v8_Message_GetStackTrace(c, self.1)).unwrap() };
6767

6868
StackTrace(self.0.clone(), raw)
6969
}
@@ -77,12 +77,12 @@ impl StackTrace {
7777
/// The stack frames that this stack trace consists of.
7878
pub fn get_frames(&self) -> Vec<StackFrame> {
7979
let count =
80-
unsafe { util::invoke(&self.0, |c| v8::StackTrace_GetFrameCount(c, self.1)).unwrap() };
80+
unsafe { util::invoke(&self.0, |c| v8::v8_StackTrace_GetFrameCount(c, self.1)).unwrap() };
8181
let mut result = Vec::with_capacity(count as usize);
8282

8383
for i in 0..count {
8484
let raw_frame = unsafe {
85-
util::invoke(&self.0, |c| v8::StackTrace_GetFrame(c, self.1, i as u32)).unwrap()
85+
util::invoke(&self.0, |c| v8::v8_StackTrace_GetFrame(c, self.1, i as u32)).unwrap()
8686
};
8787
let frame = StackFrame(self.0.clone(), raw_frame);
8888
result.push(frame);
@@ -107,19 +107,19 @@ impl StackFrame {
107107
/// The line number at which this stack frame was pushed.
108108
pub fn get_line_number(&self) -> u32 {
109109
unsafe {
110-
util::invoke(&self.0, |c| v8::StackFrame_GetLineNumber(c, self.1)).unwrap() as u32
110+
util::invoke(&self.0, |c| v8::v8_StackFrame_GetLineNumber(c, self.1)).unwrap() as u32
111111
}
112112
}
113113

114114
/// The column number at which this stack frame was pushed.
115115
pub fn get_column(&self) -> u32 {
116-
unsafe { util::invoke(&self.0, |c| v8::StackFrame_GetColumn(c, self.1)).unwrap() as u32 }
116+
unsafe { util::invoke(&self.0, |c| v8::v8_StackFrame_GetColumn(c, self.1)).unwrap() as u32 }
117117
}
118118

119119
/// The script file name in which this stack frame was pushed.
120120
pub fn get_script_name(&self) -> Option<value::String> {
121121
unsafe {
122-
let raw = util::invoke(&self.0, |c| v8::StackFrame_GetScriptName(c, self.1)).unwrap();
122+
let raw = util::invoke(&self.0, |c| v8::v8_StackFrame_GetScriptName(c, self.1)).unwrap();
123123
if raw.is_null() {
124124
None
125125
} else {
@@ -131,19 +131,19 @@ impl StackFrame {
131131
/// The function name in which this stack frame was pushed.
132132
pub fn get_function_name(&self) -> value::String {
133133
unsafe {
134-
let raw = util::invoke(&self.0, |c| v8::StackFrame_GetFunctionName(c, self.1)).unwrap();
134+
let raw = util::invoke(&self.0, |c| v8::v8_StackFrame_GetFunctionName(c, self.1)).unwrap();
135135
value::String::from_raw(&self.0, raw)
136136
}
137137
}
138138

139139
/// Whether this stack frame is part of an eval call.
140140
pub fn is_eval(&self) -> bool {
141-
unsafe { 0 != util::invoke(&self.0, |c| v8::StackFrame_IsEval(c, self.1)).unwrap() }
141+
unsafe { util::invoke(&self.0, |c| v8::v8_StackFrame_IsEval(c, self.1)).unwrap() }
142142
}
143143

144144
/// Whether this stack frame is part of a constructor call.
145145
pub fn is_constructor(&self) -> bool {
146-
unsafe { 0 != util::invoke(&self.0, |c| v8::StackFrame_IsConstructor(c, self.1)).unwrap() }
146+
unsafe { util::invoke(&self.0, |c| v8::v8_StackFrame_IsConstructor(c, self.1)).unwrap() }
147147
}
148148

149149
/// Creates a captured version of this stack frame, that doesn't retain a reference to its
@@ -209,10 +209,10 @@ impl fmt::Display for CapturedStackFrame {
209209
}
210210
}
211211

212-
reference!(Message, v8::Message_CloneRef, v8::Message_DestroyRef);
212+
reference!(Message, v8::v8_Message_CloneRef, v8::v8_Message_DestroyRef);
213213
reference!(StackTrace,
214-
v8::StackTrace_CloneRef,
215-
v8::StackTrace_DestroyRef);
214+
v8::v8_StackTrace_CloneRef,
215+
v8::v8_StackTrace_DestroyRef);
216216
reference!(StackFrame,
217-
v8::StackFrame_CloneRef,
218-
v8::StackFrame_DestroyRef);
217+
v8::v8_StackFrame_CloneRef,
218+
v8::v8_StackFrame_DestroyRef);

src/isolate.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl Isolate {
9797
/// function callback.
9898
pub fn current_context(&self) -> Option<context::Context> {
9999
unsafe {
100-
let raw = v8::Isolate_GetCurrentContext(self.as_raw()).as_mut();
100+
let raw = v8::v8_Isolate_GetCurrentContext(self.as_raw()).as_mut();
101101
raw.map(|r| context::Context::from_raw(self, r))
102102
}
103103
}
@@ -178,7 +178,7 @@ impl Isolate {
178178
}
179179

180180
unsafe fn get_data_ptr(&self) -> *mut Data {
181-
v8::Isolate_GetData(self.0, DATA_PTR_SLOT) as *mut Data
181+
v8::v8_Isolate_GetData(self.0, DATA_PTR_SLOT) as *mut Data
182182
}
183183

184184
unsafe fn get_data(&self) -> &mut Data {
@@ -203,7 +203,7 @@ impl Drop for Isolate {
203203

204204
if *count == 0 {
205205
drop(Box::from_raw(self.get_data_ptr()));
206-
v8::Isolate_Dispose(self.0);
206+
v8::v8_Isolate_Dispose(self.0);
207207
}
208208
}
209209
}
@@ -223,13 +223,13 @@ impl Builder {
223223

224224
let allocator = allocator::Allocator::new();
225225

226-
let raw = unsafe { v8::Isolate_New(allocator.as_raw()) };
226+
let raw = unsafe { v8::v8_Isolate_New(allocator.as_raw()) };
227227
if raw.is_null() {
228228
panic!("Could not create Isolate");
229229
}
230230

231231
unsafe {
232-
assert!(v8::Isolate_GetNumberOfDataSlots(raw) > 0);
232+
assert!(v8::v8_Isolate_GetNumberOfDataSlots(raw) > 0);
233233
}
234234

235235
let idle_task_queue = if self.supports_idle_tasks {
@@ -247,8 +247,8 @@ impl Builder {
247247
let data_ptr: *mut Data = Box::into_raw(Box::new(data));
248248

249249
unsafe {
250-
v8::Isolate_SetData(raw, DATA_PTR_SLOT, data_ptr as *mut os::raw::c_void);
251-
v8::Isolate_SetCaptureStackTraceForUncaughtExceptions_Detailed(raw, 1, 1024);
250+
v8::v8_Isolate_SetData(raw, DATA_PTR_SLOT, data_ptr as *mut os::raw::c_void);
251+
v8::v8_Isolate_SetCaptureStackTraceForUncaughtExceptions_Detailed(raw, true, 1024);
252252
}
253253

254254
Isolate(raw)
@@ -270,14 +270,14 @@ impl Ord for ScheduledTask {
270270
fn ensure_initialized() {
271271
INITIALIZE.call_once(|| {
272272
unsafe {
273-
v8::V8_InitializeICU();
273+
v8::v8_V8_InitializeICU();
274274

275275
let platform = platform::Platform::new();
276-
v8::V8_InitializePlatform(platform.as_raw());
276+
v8::v8_V8_InitializePlatform(platform.as_raw());
277277
// TODO: implement some form of cleanup
278278
mem::forget(platform);
279279

280-
v8::V8_Initialize();
280+
v8::v8_V8_Initialize();
281281
}
282282
});
283283
}

src/platform.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct IdleTask(v8::IdleTaskPtr);
2727

2828
impl Platform {
2929
pub fn new() -> Platform {
30-
let raw = unsafe { v8::Platform_Create(PLATFORM_FUNCTIONS) };
30+
let raw = unsafe { v8::v8_Platform_Create(PLATFORM_FUNCTIONS) };
3131

3232
if raw.is_null() {
3333
panic!("Could not create Platform")
@@ -44,44 +44,44 @@ impl Platform {
4444
impl Drop for Platform {
4545
fn drop(&mut self) {
4646
unsafe {
47-
v8::Platform_Destroy(self.0);
47+
v8::v8_Platform_Destroy(self.0);
4848
}
4949
}
5050
}
5151

5252
impl Task {
5353
pub fn run(&self) {
5454
unsafe {
55-
v8::Task_Run(self.0);
55+
v8::v8_Task_Run(self.0);
5656
}
5757
}
5858
}
5959

6060
impl Drop for Task {
6161
fn drop(&mut self) {
6262
unsafe {
63-
v8::Task_Destroy(self.0);
63+
v8::v8_Task_Destroy(self.0);
6464
}
6565
}
6666
}
6767

6868
impl IdleTask {
6969
pub fn run(&self, deadline: time::Duration) {
7070
unsafe {
71-
v8::IdleTask_Run(self.0, duration_to_seconds(deadline));
71+
v8::v8_IdleTask_Run(self.0, duration_to_seconds(deadline));
7272
}
7373
}
7474
}
7575

7676
impl Drop for IdleTask {
7777
fn drop(&mut self) {
7878
unsafe {
79-
v8::IdleTask_Destroy(self.0);
79+
v8::v8_IdleTask_Destroy(self.0);
8080
}
8181
}
8282
}
8383

84-
const PLATFORM_FUNCTIONS: v8::PlatformFunctions = v8::PlatformFunctions {
84+
const PLATFORM_FUNCTIONS: v8::v8_PlatformFunctions = v8::v8_PlatformFunctions {
8585
Destroy: Some(destroy_platform),
8686
NumberOfAvailableBackgroundThreads: Some(number_of_available_background_threads),
8787
CallOnBackgroundThread: Some(call_on_background_thread),
@@ -96,16 +96,16 @@ extern "C" fn destroy_platform() {
9696
// No-op
9797
}
9898

99-
extern "C" fn number_of_available_background_threads() -> usize {
100-
num_cpus::get()
99+
extern "C" fn number_of_available_background_threads() -> u64 {
100+
num_cpus::get() as u64
101101
}
102102

103103
extern "C" fn call_on_background_thread(task: v8::TaskPtr,
104-
_expected_runtime: v8::ExpectedRuntime) {
104+
_expected_runtime: v8::v8_ExpectedRuntime) {
105105
let task = Task(task);
106106
thread::spawn(move || {
107107
unsafe {
108-
v8::Task_Run(task.0);
108+
v8::v8_Task_Run(task.0);
109109
}
110110
});
111111
}
@@ -134,10 +134,10 @@ extern "C" fn call_idle_on_foreground_thread(isolate: v8::IsolatePtr, idle_task:
134134
isolate.enqueue_idle_task(idle_task);
135135
}
136136

137-
extern "C" fn idle_tasks_enabled(isolate: v8::IsolatePtr) -> u8 {
137+
extern "C" fn idle_tasks_enabled(isolate: v8::IsolatePtr) -> bool {
138138
let isolate = unsafe { isolate::Isolate::from_raw(isolate) };
139139

140-
if isolate.supports_idle_tasks() { 1 } else { 0 }
140+
isolate.supports_idle_tasks()
141141
}
142142

143143
extern "C" fn monotonically_increasing_time() -> f64 {

src/script.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl Script {
2020
let raw = unsafe {
2121
try!(util::invoke_ctx(isolate,
2222
context,
23-
|c| v8::Script_Compile(c, context.as_raw(), source.as_raw())))
23+
|c| v8::v8_Script_Compile(c, context.as_raw(), source.as_raw())))
2424
};
2525
Ok(Script(isolate.clone(), raw))
2626
}
@@ -37,7 +37,7 @@ impl Script {
3737
use std::ptr::null_mut as n;
3838
let raw = unsafe {
3939
try!(util::invoke_ctx(isolate, context, |c| {
40-
v8::Script_Compile_Origin(c,
40+
v8::v8_Script_Compile_Origin(c,
4141
context.as_raw(),
4242
source.as_raw(),
4343
name.as_raw(),
@@ -62,10 +62,10 @@ impl Script {
6262
unsafe {
6363
let raw = try!(util::invoke_ctx(&self.0,
6464
context,
65-
|c| v8::Script_Run(c, self.1, context.as_raw())));
65+
|c| v8::v8_Script_Run(c, self.1, context.as_raw())));
6666
Ok(value::Value::from_raw(&self.0, raw))
6767
}
6868
}
6969
}
7070

71-
reference!(Script, v8::Script_CloneRef, v8::Script_DestroyRef);
71+
reference!(Script, v8::v8_Script_CloneRef, v8::v8_Script_DestroyRef);

0 commit comments

Comments
 (0)