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

Unified Diff: src/isolate.cc

Issue 2415023002: [promises] Move async debug event creation to c++ (Closed)
Patch Set: use consts 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..1701a919af6dec608d41c8b1abdcaaa52e35efbd 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -3070,26 +3070,34 @@ 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_)) {
if (is_debug_active_) {
+ static const char will_handle[] = "willHandle";
adamk 2016/10/13 15:59:10 Rather than recreating a string for this every tim
gsathya 2016/10/13 21:27:30 Done.
isolate_->debug()->OnAsyncTaskEvent(
- handle(JSObject::cast(before), isolate_));
+ isolate_->factory()->NewStringFromAsciiChecked(will_handle), id_,
+ name_);
}
}
~PromiseDebugEventScope() {
if (is_debug_active_) {
- isolate_->debug()->OnAsyncTaskEvent(Handle<JSObject>::cast(after_));
+ static const char did_handle[] = "didHandle";
+ isolate_->debug()->OnAsyncTaskEvent(
+ isolate_->factory()->NewStringFromAsciiChecked(did_handle), id_,
+ name_);
}
}
private:
Isolate* isolate_;
- Handle<Object> after_;
+ Handle<Object> id_;
+ Handle<Object> name_;
bool is_debug_active_;
};
} // namespace
@@ -3097,8 +3105,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->id(), info->name());
Handle<Object> value(info->value(), this);
Handle<Object> tasks(info->tasks(), this);
@@ -3139,8 +3146,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->id(), info->name());
Handle<JSReceiver> thenable(info->thenable(), this);
Handle<JSFunction> resolve(info->resolve(), this);

Powered by Google App Engine
This is Rietveld 408576698