Skip to content

Commit 1b8accf

Browse files
Eugene Ostroukhovofrobots
Eugene Ostroukhov
authored andcommitted
inspector: use new inspector headers
PR-URL: #8150 Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
1 parent 61faabd commit 1b8accf

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

src/inspector_agent.cc

+17-18
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
#include "platform/v8_inspector/public/V8InspectorClient.h"
1515
#include "platform/v8_inspector/public/V8InspectorSession.h"
1616
#include "platform/v8_inspector/public/V8StackTrace.h"
17-
#include "platform/inspector_protocol/FrontendChannel.h"
18-
#include "platform/inspector_protocol/String16.h"
19-
#include "platform/inspector_protocol/Values.h"
17+
#include "platform/inspector_protocol/InspectorProtocol.h"
2018

2119
#include "libplatform/libplatform.h"
2220

@@ -196,7 +194,6 @@ class AgentImpl {
196194
void OnInspectorConnectionIO(inspector_socket_t* socket);
197195
void OnRemoteDataIO(inspector_socket_t* stream, ssize_t read,
198196
const uv_buf_t* b);
199-
void PostMessages();
200197
void SetConnected(bool connected);
201198
void DispatchMessages();
202199
void Write(int session_id, const String16& message);
@@ -285,7 +282,9 @@ class ChannelImpl final : public blink::protocol::FrontendChannel {
285282
// Used in V8NodeInspector::currentTimeMS() below.
286283
#define NANOS_PER_MSEC 1000000
287284

288-
class V8NodeInspector : public blink::V8InspectorClient {
285+
using V8Inspector = v8_inspector::V8Inspector;
286+
287+
class V8NodeInspector : public v8_inspector::V8InspectorClient {
289288
public:
290289
V8NodeInspector(AgentImpl* agent, node::Environment* env,
291290
v8::Platform* platform)
@@ -294,10 +293,9 @@ class V8NodeInspector : public blink::V8InspectorClient {
294293
platform_(platform),
295294
terminated_(false),
296295
running_nested_loop_(false),
297-
inspector_(
298-
blink::V8Inspector::create(env->isolate(), this)) {
296+
inspector_(V8Inspector::create(env->isolate(), this)) {
299297
inspector_->contextCreated(
300-
blink::V8ContextInfo(env->context(), 1, "NodeJS Main Context"));
298+
v8_inspector::V8ContextInfo(env->context(), 1, "NodeJS Main Context"));
301299
}
302300

303301
void runMessageLoopOnPause(int context_group_id) override {
@@ -339,7 +337,7 @@ class V8NodeInspector : public blink::V8InspectorClient {
339337
session_->dispatchProtocolMessage(message);
340338
}
341339

342-
blink::V8Inspector* inspector() {
340+
V8Inspector* inspector() {
343341
return inspector_.get();
344342
}
345343

@@ -349,8 +347,8 @@ class V8NodeInspector : public blink::V8InspectorClient {
349347
v8::Platform* platform_;
350348
bool terminated_;
351349
bool running_nested_loop_;
352-
std::unique_ptr<blink::V8Inspector> inspector_;
353-
std::unique_ptr<blink::V8InspectorSession> session_;
350+
std::unique_ptr<V8Inspector> inspector_;
351+
std::unique_ptr<v8_inspector::V8InspectorSession> session_;
354352
};
355353

356354
AgentImpl::AgentImpl(Environment* env) : port_(0),
@@ -417,10 +415,10 @@ void InspectorConsoleCall(const v8::FunctionCallbackInfo<v8::Value>& info) {
417415
}
418416

419417
v8::TryCatch try_catch(info.GetIsolate());
420-
node_method.As<v8::Function>()->Call(context,
421-
info.Holder(),
422-
call_args.size(),
423-
call_args.data());
418+
static_cast<void>(node_method.As<v8::Function>()->Call(context,
419+
info.Holder(),
420+
call_args.size(),
421+
call_args.data()));
424422
CHECK(config_object->Delete(context, in_call_key).FromJust());
425423
if (try_catch.HasCaught())
426424
try_catch.ReThrow();
@@ -510,7 +508,7 @@ String16 ToProtocolString(v8::Local<v8::Value> value) {
510508
return String16();
511509
}
512510
v8::Local<v8::String> string_value = v8::Local<v8::String>::Cast(value);
513-
wstring buffer(string_value->Length(), '\0');
511+
std::basic_string<uint16_t> buffer(string_value->Length(), '\0');
514512
string_value->Write(&buffer[0], 0, string_value->Length());
515513
return String16(buffer);
516514
}
@@ -523,7 +521,7 @@ void AgentImpl::FatalException(v8::Local<v8::Value> error,
523521
v8::Local<v8::Context> context = env->context();
524522

525523
int script_id = message->GetScriptOrigin().ScriptID()->Value();
526-
std::unique_ptr<blink::V8StackTrace> stack_trace =
524+
std::unique_ptr<v8_inspector::V8StackTrace> stack_trace =
527525
inspector_->inspector()->createStackTrace(message->GetStackTrace());
528526

529527
if (stack_trace && !stack_trace->isEmpty() &&
@@ -592,7 +590,8 @@ void AgentImpl::OnRemoteDataIO(inspector_socket_t* socket,
592590
// engages, node should wait for the run callback from the remote client
593591
// and initiate its startup. This is a change to node.cc that should be
594592
// upstreamed separately.
595-
if (wait_ && str.find("\"Runtime.run\"") != std::string::npos) {
593+
if (wait_&& str.find("\"Runtime.runIfWaitingForDebugger\"")
594+
!= std::string::npos) {
596595
wait_ = false;
597596
uv_sem_post(&start_sem_);
598597
}

0 commit comments

Comments
 (0)