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

Unified Diff: src/assert-scope.cc

Issue 2635913002: [ast] Remove internalization before AST rewriting (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/assert-scope.cc
diff --git a/src/assert-scope.cc b/src/assert-scope.cc
index 38527099667acc827a55f164af22ffda4d685307..a14b07f42b9e7ccd763f27bf67d552ee6a8b73c5 100644
--- a/src/assert-scope.cc
+++ b/src/assert-scope.cc
@@ -83,7 +83,7 @@ PerThreadAssertScope<kType, kAllow>::PerThreadAssertScope()
template <PerThreadAssertType kType, bool kAllow>
PerThreadAssertScope<kType, kAllow>::~PerThreadAssertScope() {
- DCHECK_NOT_NULL(data_);
+ if (data_ == nullptr) return;
data_->Set(kType, old_state_);
if (data_->DecrementLevel()) {
PerThreadAssertData::SetCurrent(NULL);
@@ -91,6 +91,16 @@ PerThreadAssertScope<kType, kAllow>::~PerThreadAssertScope() {
}
rmcilroy 2017/01/17 10:41:31 Could you just call Release here rather than dupli
Leszek Swirski 2017/01/17 12:11:49 Not directly, because of the DCHECK, but extracted
Leszek Swirski 2017/01/17 12:17:18 Ignore me, I'm an idiot. Done.
}
+template <PerThreadAssertType kType, bool kAllow>
+void PerThreadAssertScope<kType, kAllow>::Release() {
+ DCHECK_NOT_NULL(data_);
+ data_->Set(kType, old_state_);
+ if (data_->DecrementLevel()) {
+ PerThreadAssertData::SetCurrent(NULL);
+ delete data_;
+ }
+ data_ = nullptr;
+}
// static
template <PerThreadAssertType kType, bool kAllow>
« no previous file with comments | « src/assert-scope.h ('k') | src/parsing/rewriter.cc » ('j') | src/parsing/rewriter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698