Chromium Code Reviews

Unified Diff: test/inspector/task-runner.cc

Issue 2465553003: [inspector] added Debugger.getPossibleBreakpoints method (Closed)
Patch Set: addressed comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « test/inspector/task-runner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/task-runner.cc
diff --git a/test/inspector/task-runner.cc b/test/inspector/task-runner.cc
index 95700d5cb39eed51ba1438e4129f95ab02e4c3c1..51fd11020324ebc3d5f0e143becf5576b654bf71 100644
--- a/test/inspector/task-runner.cc
+++ b/test/inspector/task-runner.cc
@@ -123,13 +123,29 @@ TaskRunner* TaskRunner::FromContext(v8::Local<v8::Context> context) {
context->GetAlignedPointerFromEmbedderData(kTaskRunnerIndex));
}
+namespace {
+
+v8::internal::Vector<uint16_t> ToVector(v8::Local<v8::String> str) {
+ v8::internal::Vector<uint16_t> buffer =
+ v8::internal::Vector<uint16_t>::New(str->Length());
+ str->Write(buffer.start(), 0, str->Length());
+ return buffer;
+}
+
+} // namespace
+
ExecuteStringTask::ExecuteStringTask(
- const v8::internal::Vector<uint16_t>& expression)
- : expression_(expression) {}
+ const v8::internal::Vector<uint16_t>& expression,
+ v8::Local<v8::String> name, v8::Local<v8::Integer> line_offset,
+ v8::Local<v8::Integer> column_offset)
+ : expression_(expression),
+ name_(ToVector(name)),
+ line_offset_(line_offset.As<v8::Int32>()->Value()),
+ column_offset_(column_offset.As<v8::Int32>()->Value()) {}
ExecuteStringTask::ExecuteStringTask(
const v8::internal::Vector<const char>& expression)
- : expression_utf8_(expression) {}
+ : expression_utf8_(expression), line_offset_(0), column_offset_(0) {}
void ExecuteStringTask::Run(v8::Isolate* isolate,
const v8::Global<v8::Context>& context) {
@@ -139,7 +155,15 @@ void ExecuteStringTask::Run(v8::Isolate* isolate,
v8::Local<v8::Context> local_context = context.Get(isolate);
v8::Context::Scope context_scope(local_context);
- v8::ScriptOrigin origin(v8::String::Empty(isolate));
+ v8::Local<v8::String> name =
+ v8::String::NewFromTwoByte(isolate, name_.start(),
+ v8::NewStringType::kNormal, name_.length())
+ .ToLocalChecked();
+ v8::Local<v8::Integer> line_offset = v8::Integer::New(isolate, line_offset_);
+ v8::Local<v8::Integer> column_offset =
+ v8::Integer::New(isolate, column_offset_);
+
+ v8::ScriptOrigin origin(name, line_offset, column_offset);
v8::Local<v8::String> source;
if (expression_.length()) {
source = v8::String::NewFromTwoByte(isolate, expression_.start(),
« no previous file with comments | « test/inspector/task-runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine