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

Unified Diff: src/api.cc

Issue 2248063002: Revert of [api] Templatize do_callback parameter in CallDepthScope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | « include/v8.h ('k') | src/isolate.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 a29d294fafd6ca7fbbd5b6d57b6ea5ba5b7f8e50..02c36ffa11f72a23434e76b0315560830c93407c 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -86,7 +86,7 @@
return bailout_value; \
} \
HandleScopeClass handle_scope(isolate); \
- CallDepthScope<do_callback> call_depth_scope(isolate, context); \
+ CallDepthScope call_depth_scope(isolate, context, do_callback); \
LOG_API(isolate, class_name, function_name); \
ENTER_V8(isolate); \
bool has_pending_exception = false
@@ -170,11 +170,15 @@
}
#endif
-template <bool do_callback>
+
class CallDepthScope {
public:
- explicit CallDepthScope(i::Isolate* isolate, Local<Context> context)
- : isolate_(isolate), context_(context), escaped_(false) {
+ explicit CallDepthScope(i::Isolate* isolate, Local<Context> context,
+ bool do_callback)
+ : isolate_(isolate),
+ context_(context),
+ escaped_(false),
+ do_callback_(do_callback) {
// TODO(dcarney): remove this when blink stops crashing.
DCHECK(!isolate_->external_caught_exception());
isolate_->IncrementJsCallsFromApiCounter();
@@ -190,14 +194,14 @@
context_->Enter();
}
}
- if (do_callback) isolate_->FireBeforeCallEnteredCallback();
+ if (do_callback_) isolate_->FireBeforeCallEnteredCallback();
}
~CallDepthScope() {
if (!context_.IsEmpty()) context_->Exit();
if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth();
- if (do_callback) isolate_->FireCallCompletedCallback();
+ if (do_callback_) isolate_->FireCallCompletedCallback();
#ifdef DEBUG
- if (do_callback) CheckMicrotasksScopesConsistency(isolate_);
+ if (do_callback_) CheckMicrotasksScopesConsistency(isolate_);
#endif
}
@@ -905,9 +909,12 @@
return escape_slot_;
}
-SealHandleScope::SealHandleScope(Isolate* isolate)
- : isolate_(reinterpret_cast<i::Isolate*>(isolate)) {
- i::HandleScopeData* current = isolate_->handle_scope_data();
+
+SealHandleScope::SealHandleScope(Isolate* isolate) {
+ i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
+
+ isolate_ = internal_isolate;
+ i::HandleScopeData* current = internal_isolate->handle_scope_data();
prev_limit_ = current->limit;
current->limit = current->next;
prev_sealed_level_ = current->sealed_level;
« no previous file with comments | « include/v8.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698