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

Side by Side Diff: src/isolate.cc

Issue 2606093002: [promises] Refactor debug code (Closed)
Patch Set: fix stuff Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/isolate.h ('k') | src/js/async-await.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "src/isolate.h" 5 #include "src/isolate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <fstream> // NOLINT(readability/streams) 9 #include <fstream> // NOLINT(readability/streams)
10 #include <sstream> 10 #include <sstream>
(...skipping 3240 matching lines...) Expand 10 before | Expand all | Expand 10 after
3251 stack_trace = GetDetailedStackTrace(Handle<JSObject>::cast(value)); 3251 stack_trace = GetDetailedStackTrace(Handle<JSObject>::cast(value));
3252 } 3252 }
3253 promise_reject_callback_(v8::PromiseRejectMessage( 3253 promise_reject_callback_(v8::PromiseRejectMessage(
3254 v8::Utils::PromiseToLocal(promise), event, v8::Utils::ToLocal(value), 3254 v8::Utils::PromiseToLocal(promise), event, v8::Utils::ToLocal(value),
3255 v8::Utils::StackTraceToLocal(stack_trace))); 3255 v8::Utils::StackTraceToLocal(stack_trace)));
3256 } 3256 }
3257 3257
3258 namespace { 3258 namespace {
3259 class PromiseDebugEventScope { 3259 class PromiseDebugEventScope {
3260 public: 3260 public:
3261 PromiseDebugEventScope(Isolate* isolate, Object* id, Object* name) 3261 PromiseDebugEventScope(Isolate* isolate, int id, int name)
3262 : isolate_(isolate), 3262 : isolate_(isolate),
3263 id_(id, isolate_), 3263 id_(id),
3264 name_(name, isolate_), 3264 name_(static_cast<PromiseDebugActionName>(name)),
3265 is_debug_active_(isolate_->debug()->is_active() && id_->IsNumber() && 3265 is_debug_active_(isolate_->debug()->is_active() &&
3266 name_->IsString()) { 3266 id != kDebugPromiseNoID && name_ != kDebugNotActive) {
3267 if (is_debug_active_) { 3267 if (is_debug_active_) {
3268 isolate_->debug()->OnAsyncTaskEvent( 3268 isolate_->debug()->OnAsyncTaskEvent(kDebugWillHandle, id_, name_);
3269 isolate_->factory()->will_handle_string(), id_,
3270 Handle<String>::cast(name_));
3271 } 3269 }
3272 } 3270 }
3273 3271
3274 ~PromiseDebugEventScope() { 3272 ~PromiseDebugEventScope() {
3275 if (is_debug_active_) { 3273 if (is_debug_active_) {
3276 isolate_->debug()->OnAsyncTaskEvent( 3274 isolate_->debug()->OnAsyncTaskEvent(kDebugDidHandle, id_, name_);
3277 isolate_->factory()->did_handle_string(), id_,
3278 Handle<String>::cast(name_));
3279 } 3275 }
3280 } 3276 }
3281 3277
3282 private: 3278 private:
3283 Isolate* isolate_; 3279 Isolate* isolate_;
3284 Handle<Object> id_; 3280 int id_;
3285 Handle<Object> name_; 3281 PromiseDebugActionName name_;
3286 bool is_debug_active_; 3282 bool is_debug_active_;
3287 }; 3283 };
3288 } // namespace 3284 } // namespace
3289 3285
3290 void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info, 3286 void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info,
3291 MaybeHandle<Object>* result, 3287 MaybeHandle<Object>* result,
3292 MaybeHandle<Object>* maybe_exception) { 3288 MaybeHandle<Object>* maybe_exception) {
3293 PromiseDebugEventScope helper(this, info->debug_id(), info->debug_name()); 3289 PromiseDebugEventScope helper(this, info->debug_id(), info->debug_name());
3294 3290
3295 Handle<JSPromise> promise(info->promise(), this); 3291 Handle<JSPromise> promise(info->promise(), this);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
3660 // Then check whether this scope intercepts. 3656 // Then check whether this scope intercepts.
3661 if ((flag & intercept_mask_)) { 3657 if ((flag & intercept_mask_)) {
3662 intercepted_flags_ |= flag; 3658 intercepted_flags_ |= flag;
3663 return true; 3659 return true;
3664 } 3660 }
3665 return false; 3661 return false;
3666 } 3662 }
3667 3663
3668 } // namespace internal 3664 } // namespace internal
3669 } // namespace v8 3665 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/js/async-await.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698