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

Unified Diff: src/isolate.cc

Issue 2415023002: [promises] Move async debug event creation to c++ (Closed)
Patch Set: address review comments Created 4 years, 2 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
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 792706dc71c54dc2de0bd5f992044004d26f2b46..4253be2b55264ea17e6c7a300bfb4460487a4dff 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -3070,26 +3070,32 @@ void Isolate::ReportPromiseReject(Handle<JSObject> promise,
namespace {
class PromiseDebugEventScope {
public:
- PromiseDebugEventScope(Isolate* isolate, Object* before, Object* after)
+ PromiseDebugEventScope(Isolate* isolate, Object* id, Object* name)
: isolate_(isolate),
- after_(after, isolate_),
+ id_(id, isolate_),
+ name_(name, isolate_),
is_debug_active_(isolate_->debug()->is_active() &&
- before->IsJSObject() && after->IsJSObject()) {
+ !id_->IsUndefined(isolate_) &&
+ !name_->IsUndefined(isolate_)) {
gsathya 2016/10/13 21:27:30 I wonder if it'd be better to do a id_->IsNumber()
adamk 2016/10/14 20:34:51 Yeah, that seems better to me.
gsathya 2016/10/14 22:21:27 Done.
if (is_debug_active_) {
isolate_->debug()->OnAsyncTaskEvent(
- handle(JSObject::cast(before), isolate_));
+ isolate_->factory()->will_handle_string(), id_,
+ Handle<String>::cast(name_));
}
}
~PromiseDebugEventScope() {
if (is_debug_active_) {
- isolate_->debug()->OnAsyncTaskEvent(Handle<JSObject>::cast(after_));
+ isolate_->debug()->OnAsyncTaskEvent(
+ isolate_->factory()->did_handle_string(), id_,
+ Handle<String>::cast(name_));
}
}
private:
Isolate* isolate_;
- Handle<Object> after_;
+ Handle<Object> id_;
+ Handle<Object> name_;
bool is_debug_active_;
};
} // namespace
@@ -3097,8 +3103,7 @@ class PromiseDebugEventScope {
void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info,
MaybeHandle<Object>* result,
MaybeHandle<Object>* maybe_exception) {
- PromiseDebugEventScope helper(this, info->before_debug_event(),
- info->after_debug_event());
+ PromiseDebugEventScope helper(this, info->debug_id(), info->debug_name());
Handle<Object> value(info->value(), this);
Handle<Object> tasks(info->tasks(), this);
@@ -3139,8 +3144,7 @@ void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info,
void Isolate::PromiseResolveThenableJob(
Handle<PromiseResolveThenableJobInfo> info, MaybeHandle<Object>* result,
MaybeHandle<Object>* maybe_exception) {
- PromiseDebugEventScope helper(this, info->before_debug_event(),
- info->after_debug_event());
+ PromiseDebugEventScope helper(this, info->debug_id(), info->debug_name());
Handle<JSReceiver> thenable(info->thenable(), this);
Handle<JSFunction> resolve(info->resolve(), this);
« src/heap-symbols.h ('K') | « src/heap-symbols.h ('k') | src/js/async-await.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698