mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-24 15:19:31 -05:00
Add V8InspectorClientImpl::generate_unique_id() (#590)
This commit is contained in:
parent
09defbdcb1
commit
30ad399f9b
3 changed files with 36 additions and 0 deletions
|
@ -1914,6 +1914,8 @@ void v8_inspector__V8Inspector__Channel__flushProtocolNotifications(
|
|||
self->flushProtocolNotifications();
|
||||
}
|
||||
|
||||
int64_t v8_inspector__V8InspectorClient__BASE__generateUniqueId(
|
||||
v8_inspector::V8InspectorClient* self);
|
||||
void v8_inspector__V8InspectorClient__BASE__runMessageLoopOnPause(
|
||||
v8_inspector::V8InspectorClient* self, int contextGroupId);
|
||||
void v8_inspector__V8InspectorClient__BASE__quitMessageLoopOnPause(
|
||||
|
@ -1932,6 +1934,9 @@ struct v8_inspector__V8InspectorClient__BASE
|
|||
: public v8_inspector::V8InspectorClient {
|
||||
using v8_inspector::V8InspectorClient::V8InspectorClient;
|
||||
|
||||
int64_t generateUniqueId() override {
|
||||
return v8_inspector__V8InspectorClient__BASE__generateUniqueId(this);
|
||||
}
|
||||
void runMessageLoopOnPause(int contextGroupId) override {
|
||||
v8_inspector__V8InspectorClient__BASE__runMessageLoopOnPause(
|
||||
this, contextGroupId);
|
||||
|
@ -1961,6 +1966,11 @@ void v8_inspector__V8InspectorClient__BASE__CONSTRUCT(
|
|||
construct_in_place<v8_inspector__V8InspectorClient__BASE>(buf);
|
||||
}
|
||||
|
||||
int64_t v8_inspector__V8InspectorClient__generateUniqueId(
|
||||
v8_inspector::V8InspectorClient* self) {
|
||||
return self->generateUniqueId();
|
||||
}
|
||||
|
||||
void v8_inspector__V8InspectorClient__runMessageLoopOnPause(
|
||||
v8_inspector::V8InspectorClient* self, int contextGroupId) {
|
||||
self->runMessageLoopOnPause(contextGroupId);
|
||||
|
|
|
@ -47,6 +47,9 @@ extern "C" {
|
|||
buf: &mut std::mem::MaybeUninit<V8InspectorClient>,
|
||||
);
|
||||
|
||||
fn v8_inspector__V8InspectorClient__generateUniqueId(
|
||||
this: &mut V8InspectorClient,
|
||||
) -> i64;
|
||||
fn v8_inspector__V8InspectorClient__runMessageLoopOnPause(
|
||||
this: &mut V8InspectorClient,
|
||||
context_group_id: int,
|
||||
|
@ -129,6 +132,13 @@ pub unsafe extern "C" fn v8_inspector__V8Inspector__Channel__BASE__flushProtocol
|
|||
ChannelBase::dispatch_mut(this).flush_protocol_notifications()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn v8_inspector__V8InspectorClient__BASE__generateUniqueId(
|
||||
this: &mut V8InspectorClient,
|
||||
) -> i64 {
|
||||
V8InspectorClientBase::dispatch_mut(this).generate_unique_id()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn v8_inspector__V8InspectorClient__BASE__runMessageLoopOnPause(
|
||||
this: &mut V8InspectorClient,
|
||||
|
@ -443,6 +453,10 @@ impl V8InspectorClient {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn generate_unique_id(&mut self) -> i64 {
|
||||
unsafe { v8_inspector__V8InspectorClient__generateUniqueId(self) }
|
||||
}
|
||||
}
|
||||
|
||||
pub trait AsV8InspectorClient {
|
||||
|
@ -480,6 +494,10 @@ pub trait V8InspectorClientImpl: AsV8InspectorClient {
|
|||
fn quit_message_loop_on_pause(&mut self) {}
|
||||
fn run_if_waiting_for_debugger(&mut self, context_group_id: i32) {}
|
||||
|
||||
fn generate_unique_id(&mut self) -> i64 {
|
||||
0 // 0 = let V8 pick a unique id itself
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn console_api_message(
|
||||
&mut self,
|
||||
|
|
|
@ -3179,6 +3179,7 @@ struct ClientCounter {
|
|||
count_run_message_loop_on_pause: usize,
|
||||
count_quit_message_loop_on_pause: usize,
|
||||
count_run_if_waiting_for_debugger: usize,
|
||||
count_generate_unique_id: i64,
|
||||
}
|
||||
|
||||
impl ClientCounter {
|
||||
|
@ -3188,6 +3189,7 @@ impl ClientCounter {
|
|||
count_run_message_loop_on_pause: 0,
|
||||
count_quit_message_loop_on_pause: 0,
|
||||
count_run_if_waiting_for_debugger: 0,
|
||||
count_generate_unique_id: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3214,6 +3216,11 @@ impl v8::inspector::V8InspectorClientImpl for ClientCounter {
|
|||
assert_eq!(context_group_id, 1);
|
||||
self.count_run_message_loop_on_pause += 1;
|
||||
}
|
||||
|
||||
fn generate_unique_id(&mut self) -> i64 {
|
||||
self.count_generate_unique_id += 1;
|
||||
self.count_generate_unique_id
|
||||
}
|
||||
}
|
||||
|
||||
struct ChannelCounter {
|
||||
|
@ -3354,6 +3361,7 @@ fn inspector_schedule_pause_on_next_statement() {
|
|||
assert_eq!(client.count_run_message_loop_on_pause, 1);
|
||||
assert_eq!(client.count_quit_message_loop_on_pause, 0);
|
||||
assert_eq!(client.count_run_if_waiting_for_debugger, 0);
|
||||
assert_ne!(client.count_generate_unique_id, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue