Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: src/api.cc

Issue 2678143002: [inspector] introduced debug::GeneratorObject (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 8c878b178a19ffe66b5d54428af94f7bbce5b796..5f74b7b2f1e72b8c7351c8fd225d338f950ad917 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -9290,7 +9290,9 @@ debug::Location::Location(int line_number, int column_number)
CHECK(column_number >= 0);
}
-debug::Location::Location() : line_number_(-1), column_number_(-1) {}
+debug::Location::Location()
+ : line_number_(v8::Function::kLineOffsetNotFound),
+ column_number_(v8::Function::kLineOffsetNotFound) {}
int debug::Location::GetLineNumber() const {
CHECK(line_number_ >= 0);
@@ -9414,6 +9416,43 @@ v8::MaybeLocal<v8::Array> debug::EntriesPreview(Isolate* v8_isolate,
return v8::MaybeLocal<v8::Array>();
}
+MaybeLocal<debug::Script> debug::GeneratorObject::Script() {
+ i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this);
+ if (!obj->function()->shared()->script()->IsScript())
jgruber 2017/02/07 08:32:28 Nit: I think this'd be more readable if we store o
kozy 2017/02/07 17:09:45 Done.
+ return MaybeLocal<debug::Script>();
+ i::Handle<i::Script> script(
+ i::Script::cast(obj->function()->shared()->script()), obj->GetIsolate());
+ return ToApiHandle<debug::Script>(script);
+}
+
+Local<Function> debug::GeneratorObject::Function() {
+ i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this);
+ return Utils::ToLocal(handle(obj->function()));
+}
+
+debug::Location debug::GeneratorObject::SuspendedLocation() {
+ i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this);
+ CHECK(obj->is_suspended());
+ if (!obj->function()->shared()->script()->IsScript())
+ return debug::Location();
+ i::Handle<i::Script> script(
+ i::Script::cast(obj->function()->shared()->script()), obj->GetIsolate());
+ i::Script::PositionInfo info;
+ i::Script::GetPositionInfo(script, obj->source_position(), &info,
+ i::Script::WITH_OFFSET);
+ return debug::Location(info.line, info.column);
+}
+
+bool debug::GeneratorObject::IsSuspended() {
+ return Utils::OpenHandle(this)->is_suspended();
+}
+
+v8::Local<debug::GeneratorObject> debug::GeneratorObject::Cast(
+ v8::Local<v8::Value> value) {
+ CHECK(value->IsGeneratorObject());
+ return ToApiHandle<debug::GeneratorObject>(Utils::OpenHandle(*value));
+}
+
Local<String> CpuProfileNode::GetFunctionName() const {
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
i::Isolate* isolate = node->isolate();
« no previous file with comments | « src/api.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698