OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "test/inspector/inspector-impl.h" | 5 #include "test/inspector/inspector-impl.h" |
6 | 6 |
7 #include "include/v8.h" | 7 #include "include/v8.h" |
8 #include "src/inspector/string-16.h" | 8 #include "src/inspector/string-16.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 void MessageHandler(v8::Local<v8::Message> message, | 49 void MessageHandler(v8::Local<v8::Message> message, |
50 v8::Local<v8::Value> exception) { | 50 v8::Local<v8::Value> exception) { |
51 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 51 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
52 v8::Local<v8::Context> context = isolate->GetEnteredContext(); | 52 v8::Local<v8::Context> context = isolate->GetEnteredContext(); |
53 if (context.IsEmpty()) return; | 53 if (context.IsEmpty()) return; |
54 v8_inspector::V8Inspector* inspector = | 54 v8_inspector::V8Inspector* inspector = |
55 InspectorClientImpl::InspectorFromContext(context); | 55 InspectorClientImpl::InspectorFromContext(context); |
56 | 56 |
57 v8::Local<v8::StackTrace> stack = message->GetStackTrace(); | 57 v8::Local<v8::StackTrace> stack = message->GetStackTrace(); |
58 int script_id = message->GetScriptOrigin().ScriptID()->Value(); | 58 int script_id = |
| 59 static_cast<int>(message->GetScriptOrigin().ScriptID()->Value()); |
59 if (!stack.IsEmpty() && stack->GetFrameCount() > 0) { | 60 if (!stack.IsEmpty() && stack->GetFrameCount() > 0) { |
60 int top_script_id = stack->GetFrame(0)->GetScriptId(); | 61 int top_script_id = stack->GetFrame(0)->GetScriptId(); |
61 if (top_script_id == script_id) script_id = 0; | 62 if (top_script_id == script_id) script_id = 0; |
62 } | 63 } |
63 int line_number = message->GetLineNumber(context).FromMaybe(0); | 64 int line_number = message->GetLineNumber(context).FromMaybe(0); |
64 int column_number = 0; | 65 int column_number = 0; |
65 if (message->GetStartColumn(context).IsJust()) | 66 if (message->GetStartColumn(context).IsJust()) |
66 column_number = message->GetStartColumn(context).FromJust() + 1; | 67 column_number = message->GetStartColumn(context).FromJust() + 1; |
67 | 68 |
68 v8_inspector::StringView detailed_message; | 69 v8_inspector::StringView detailed_message; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 193 } |
193 | 194 |
194 void SendMessageToBackendExtension::SendMessageToBackend( | 195 void SendMessageToBackendExtension::SendMessageToBackend( |
195 const v8::FunctionCallbackInfo<v8::Value>& args) { | 196 const v8::FunctionCallbackInfo<v8::Value>& args) { |
196 CHECK(backend_task_runner_); | 197 CHECK(backend_task_runner_); |
197 CHECK(args.Length() == 1 && args[0]->IsString()); | 198 CHECK(args.Length() == 1 && args[0]->IsString()); |
198 v8::Local<v8::String> message = args[0].As<v8::String>(); | 199 v8::Local<v8::String> message = args[0].As<v8::String>(); |
199 backend_task_runner_->Append( | 200 backend_task_runner_->Append( |
200 new SendMessageToBackendTask(ToString16(message))); | 201 new SendMessageToBackendTask(ToString16(message))); |
201 } | 202 } |
OLD | NEW |