Skip to content

Commit

Permalink
Remove some unused methods of the Inspector.
Browse files Browse the repository at this point in the history
  • Loading branch information
iddm committed Aug 29, 2023
1 parent e53bdd8 commit f85e92b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 70 deletions.
10 changes: 0 additions & 10 deletions src/v8/inspector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ impl RawInspector {
Self { raw }
}

/// Sets a new (possibly another) [crate::v8::isolate::V8Isolate].
pub fn set_isolate(&self, raw_isolate: NonNull<v8_isolate>) {
unsafe { crate::v8_c_raw::bindings::v8_InspectorSetIsolate(self.raw, raw_isolate.as_ptr()) }
}

/// Sets a new context.
pub fn set_context(&self, raw_context: NonNull<v8_context_ref>) {
unsafe { crate::v8_c_raw::bindings::v8_InspectorSetContext(self.raw, raw_context.as_ptr()) }
}

/// Returns the isolate this inspector is bound to. The isolate
/// returned won't be released automatically.
pub fn get_isolate(&self) -> V8Isolate {
Expand Down
5 changes: 0 additions & 5 deletions src/v8/inspector/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,11 +678,6 @@ impl DebuggerSession {
}
}
}

/// Sets another context for the inspector.
pub fn set_context(&self, context: NonNull<v8_context_ref>) {
self.inspector.set_context(context);
}
}

#[cfg(test)]
Expand Down
42 changes: 0 additions & 42 deletions v8_c_api/src/v8_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,13 @@ class v8_inspector_client_wrapper final: public v8_inspector::V8InspectorClient
public:
explicit v8_inspector_client_wrapper(
v8::Platform *platform,
v8::Isolate *isolate,
const v8::Local<v8::Context> &context,
const InspectorOnResponseCallback &onResponse = {},
const InspectorOnWaitFrontendMessageOnPauseCallback &onWaitFrontendMessageOnPause = {}
);

v8::Local<v8::Context> getContext();
void setContext(const v8::Local<v8::Context> &context);
v8::Isolate* getIsolate();
void setIsolate(v8::Isolate *isolate);
void setOnResponseCallback(const InspectorOnResponseCallback &callback);
void setOnWaitFrontendMessageOnPauseCallback(const InspectorOnWaitFrontendMessageOnPauseCallback &callback);

Expand All @@ -174,9 +171,6 @@ class v8_inspector_client_wrapper final: public v8_inspector::V8InspectorClient
void schedulePauseOnNextStatement(const v8_inspector::StringView &reason);
void waitFrontendMessageOnPause();

// Can we return `v8::Local<v8::Context>` from `v8::Context *` ?
// v8::Local<v8::Context> ensureDefaultContextInGroup(const int contextGroupId) override;

private:
static const int kContextGroupId = 1;
v8::Platform* platform_;
Expand All @@ -192,13 +186,11 @@ class v8_inspector_client_wrapper final: public v8_inspector::V8InspectorClient

v8_inspector_client_wrapper::v8_inspector_client_wrapper(
v8::Platform *platform,
v8::Isolate *isolate,
const v8::Local<v8::Context> &context,
const InspectorOnResponseCallback &onResponse,
const InspectorOnWaitFrontendMessageOnPauseCallback &onWaitFrontendMessageOnPause
) :
platform_(platform),
// isolate_(isolate),
context_(context),
onWaitFrontendMessageOnPause_(onWaitFrontendMessageOnPause)
{
Expand All @@ -222,23 +214,6 @@ v8::Local<v8::Context> v8_inspector_client_wrapper::getContext() {
return context_;
}

void v8_inspector_client_wrapper::setContext(const v8::Local<v8::Context> &context) {
// context_ = context;

// // session_ = inspector_->connect(kContextGroupId, channel_.get(), v8_inspector::StringView(), v8_inspector::V8Inspector::kFullyTrusted);
// context->SetAlignedPointerInEmbedderData(DEBUGGER_INDEX, this);
// v8_inspector::StringView contextName = convertToStringView("inspector");
// inspector_->contextCreated(v8_inspector::V8ContextInfo(context, kContextGroupId, contextName));
// schedulePauseOnNextStatement(convertToStringView("Context change."));
}

void v8_inspector_client_wrapper::setIsolate(v8::Isolate *isolate) {
// isolate_ = isolate;
// channel_->setIsolate(isolate_);
// session_ = inspector_->connect(kContextGroupId, channel_.get(), v8_inspector::StringView(), v8_inspector::V8Inspector::kFullyTrusted);
// setContext(isolate_->GetCurrentContext());
}

void v8_inspector_client_wrapper::setOnResponseCallback(const InspectorOnResponseCallback &callback) {
channel_->setOnResponseCallback(callback);
}
Expand Down Expand Up @@ -409,7 +384,6 @@ struct v8_local_array_buff {
};

v8_inspector_c_wrapper* v8_InspectorCreate(
v8_isolate *isolate,
v8_context_ref *context_ref,
v8_InspectorOnResponseCallback onResponse,
void *onResponseUserData,
Expand All @@ -423,12 +397,10 @@ v8_inspector_c_wrapper* v8_InspectorCreate(
return onWaitFrontendMessageOnPause(inspector, onWaitUserData);
};
auto platform = GLOBAL_PLATFORM;
auto v8_isolate = reinterpret_cast<v8::Isolate *>(isolate);
auto context = context_ref->context;
return reinterpret_cast<v8_inspector_c_wrapper *>(
new v8_inspector_client_wrapper(
platform,
v8_isolate,
context,
onResponseWrapper,
onWaitFrontendMessageOnPauseWrapper
Expand Down Expand Up @@ -489,14 +461,6 @@ void v8_InspectorSetOnWaitFrontendMessageOnPauseCallback(
reinterpret_cast<v8_inspector_client_wrapper *>(inspector)->setOnWaitFrontendMessageOnPauseCallback(onWaitFrontendMessageOnPauseWrapper);
}

void v8_InspectorSetIsolate(
v8_inspector_c_wrapper *inspector,
v8_isolate *isolate
) {
reinterpret_cast<v8_inspector_client_wrapper *>(inspector)
->setIsolate(reinterpret_cast<v8::Isolate *>(isolate));
}

v8_isolate* v8_InspectorGetIsolate(
v8_inspector_c_wrapper *inspector
) {
Expand All @@ -511,12 +475,6 @@ v8_context_ref* v8_InspectorGetContext(
reinterpret_cast<v8_inspector_client_wrapper *>(inspector)->getContext());
}

void v8_InspectorSetContext(
v8_inspector_c_wrapper *inspector,
v8_context_ref *context
) {
reinterpret_cast<v8_inspector_client_wrapper *>(inspector)->setContext(context->context);
}

void get_v8_string_value(
v8_local_string *v8_string,
Expand Down
15 changes: 2 additions & 13 deletions v8_c_api/src/v8_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,8 @@ typedef void (*v8_InspectorOnResponseCallback)(const char *string, void *userdat
typedef int (*v8_InspectorOnWaitFrontendMessageOnPause)(v8_inspector_c_wrapper *inspector, void *userdata);

/** Creates a debugging inspector for the global platform and the given
isolate. The callbacks are optional. */
context. The callbacks are optional. */
v8_inspector_c_wrapper* v8_InspectorCreate(
v8_isolate *isolate,
v8_context_ref *context_ref,
v8_InspectorOnResponseCallback onResponse,
void *onResponseUserData,
Expand Down Expand Up @@ -176,26 +175,16 @@ void v8_InspectorSetOnWaitFrontendMessageOnPauseCallback(
void *onWaitUserData
);

/** Sets the V8Isolate for the inspector. */
void v8_InspectorSetIsolate(
v8_inspector_c_wrapper *inspector,
v8_isolate *isolate
);

/** Returns the V8Isolate the passed inspector is bound to. */
v8_isolate* v8_InspectorGetIsolate(
v8_inspector_c_wrapper *inspector
);

/** Returns the V8ContextScope the passed inspector is bound to. */
v8_context_ref* v8_InspectorGetContext(
v8_inspector_c_wrapper *inspector
);

void v8_InspectorSetContext(
v8_inspector_c_wrapper *inspector,
v8_context_ref *context
);

typedef void (*v8_StringToUtf8StringCallback)(
void *userdata,
const char *data,
Expand Down

0 comments on commit f85e92b

Please sign in to comment.