Skip to content

Commit e0c8adb

Browse files
Eugene Ostroukhovofrobots
Eugene Ostroukhov
authored andcommitted
inspector: use new inspector headers
1 parent 8a44aae commit e0c8adb

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 {
@@ -338,7 +336,7 @@ class V8NodeInspector : public blink::V8InspectorClient {
338336
session_->dispatchProtocolMessage(message);
339337
}
340338

341-
blink::V8Inspector* inspector() {
339+
V8Inspector* inspector() {
342340
return inspector_.get();
343341
}
344342

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

355353
AgentImpl::AgentImpl(Environment* env) : port_(0),
@@ -416,10 +414,10 @@ void InspectorConsoleCall(const v8::FunctionCallbackInfo<v8::Value>& info) {
416414
}
417415

418416
v8::TryCatch try_catch(info.GetIsolate());
419-
node_method.As<v8::Function>()->Call(context,
420-
info.Holder(),
421-
call_args.size(),
422-
call_args.data());
417+
static_cast<void>(node_method.As<v8::Function>()->Call(context,
418+
info.Holder(),
419+
call_args.size(),
420+
call_args.data()));
423421
CHECK(config_object->Delete(context, in_call_key).FromJust());
424422
if (try_catch.HasCaught())
425423
try_catch.ReThrow();
@@ -509,7 +507,7 @@ String16 ToProtocolString(v8::Local<v8::Value> value) {
509507
return String16();
510508
}
511509
v8::Local<v8::String> string_value = v8::Local<v8::String>::Cast(value);
512-
wstring buffer(string_value->Length(), '\0');
510+
std::basic_string<uint16_t> buffer(string_value->Length(), '\0');
513511
string_value->Write(&buffer[0], 0, string_value->Length());
514512
return String16(buffer);
515513
}
@@ -522,7 +520,7 @@ void AgentImpl::FatalException(v8::Local<v8::Value> error,
522520
v8::Local<v8::Context> context = env->context();
523521

524522
int script_id = message->GetScriptOrigin().ScriptID()->Value();
525-
std::unique_ptr<blink::V8StackTrace> stack_trace =
523+
std::unique_ptr<v8_inspector::V8StackTrace> stack_trace =
526524
inspector_->inspector()->createStackTrace(message->GetStackTrace());
527525

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

0 commit comments

Comments
 (0)