0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-24 00:00:06 -05:00

Do not use std::os::raw::c_int in public API (#259)

This commit is contained in:
Ryan Dahl 2020-01-28 17:16:31 -05:00 committed by GitHub
parent 2e61735f44
commit 62a52e0241
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 25 deletions

View file

@ -6,15 +6,6 @@ use crate::support::Opaque;
use crate::support::RustVTable;
use crate::support::UniquePtr;
// class Channel {
// public:
// virtual ~Channel() = default;
// virtual void sendResponse(int callId,
// std::unique_ptr<StringBuffer> message) = 0;
// virtual void sendNotification(std::unique_ptr<StringBuffer> message) = 0;
// virtual void flushProtocolNotifications() = 0;
// };
extern "C" {
fn v8_inspector__V8Inspector__Channel__BASE__CONSTRUCT(
buf: &mut std::mem::MaybeUninit<Channel>,
@ -66,7 +57,7 @@ pub struct Channel {
impl Channel {
pub fn send_response(
&mut self,
call_id: int,
call_id: i32,
message: UniquePtr<StringBuffer>,
) {
unsafe {
@ -117,7 +108,7 @@ pub trait ChannelImpl: AsChannel {
fn send_response(
&mut self,
call_id: int,
call_id: i32,
message: UniquePtr<StringBuffer>,
) -> ();
fn send_notification(&mut self, message: UniquePtr<StringBuffer>) -> ();

View file

@ -86,7 +86,7 @@ pub struct V8InspectorClient {
}
impl V8InspectorClient {
pub fn run_message_loop_on_pause(&mut self, context_group_id: int) {
pub fn run_message_loop_on_pause(&mut self, context_group_id: i32) {
unsafe {
v8_inspector__V8InspectorClient__runMessageLoopOnPause(
self,
@ -99,7 +99,7 @@ impl V8InspectorClient {
unsafe { v8_inspector__V8InspectorClient__quitMessageLoopOnPause(self) }
}
pub fn run_if_waiting_for_debugger(&mut self, context_group_id: int) {
pub fn run_if_waiting_for_debugger(&mut self, context_group_id: i32) {
unsafe {
v8_inspector__V8InspectorClient__runIfWaitingForDebugger(
self,
@ -111,8 +111,8 @@ impl V8InspectorClient {
#[allow(clippy::too_many_arguments)]
pub fn console_api_message(
&mut self,
context_group_id: int,
level: int,
context_group_id: i32,
level: i32,
message: &StringView,
url: &StringView,
line_number: u32,
@ -165,15 +165,15 @@ pub trait V8InspectorClientImpl: AsV8InspectorClient {
fn base(&self) -> &V8InspectorClientBase;
fn base_mut(&mut self) -> &mut V8InspectorClientBase;
fn run_message_loop_on_pause(&mut self, context_group_id: int) {}
fn run_message_loop_on_pause(&mut self, context_group_id: i32) {}
fn quit_message_loop_on_pause(&mut self) {}
fn run_if_waiting_for_debugger(&mut self, context_group_id: int) {}
fn run_if_waiting_for_debugger(&mut self, context_group_id: i32) {}
#[allow(clippy::too_many_arguments)]
fn console_api_message(
&mut self,
context_group_id: int,
level: int,
context_group_id: i32,
level: i32,
message: &StringView,
url: &StringView,
line_number: u32,

View file

@ -53,7 +53,7 @@ impl V8Inspector {
pub fn connect<T>(
&mut self,
context_group_id: int,
context_group_id: i32,
channel: &mut T,
state: &StringView,
) -> UniqueRef<V8InspectorSession>
@ -75,7 +75,7 @@ impl V8Inspector {
pub fn context_created(
&mut self,
mut context: Local<Context>,
context_group_id: int,
context_group_id: i32,
human_readable_name: &StringView,
) {
unsafe {

View file

@ -2388,24 +2388,25 @@ fn inspector_schedule_pause_on_next_statement() {
}
}
use std::os::raw::c_int as int;
impl V8InspectorClientImpl for Client {
fn base(&self) -> &V8InspectorClientBase {
&self.base
}
fn base_mut(&mut self) -> &mut V8InspectorClientBase {
&mut self.base
}
fn run_message_loop_on_pause(&mut self, context_group_id: int) {
fn run_message_loop_on_pause(&mut self, context_group_id: i32) {
assert_eq!(context_group_id, 1);
self.count_run_message_loop_on_pause += 1;
}
fn quit_message_loop_on_pause(&mut self) {
self.count_quit_message_loop_on_pause += 1;
}
fn run_if_waiting_for_debugger(&mut self, context_group_id: int) {
fn run_if_waiting_for_debugger(&mut self, context_group_id: i32) {
assert_eq!(context_group_id, 1);
self.count_run_message_loop_on_pause += 1;
}