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

Side by Side Diff: runtime/vm/log.cc

Issue 2999833002: [VM logging] Fix nesting of log blocker (second attempt). (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/log.h ('k') | runtime/vm/log_test.cc » ('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 (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/log.h" 5 #include "vm/log.h"
6 6
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/thread.h" 9 #include "vm/thread.h"
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 buffer_.Add('\0'); 142 buffer_.Add('\0');
143 } 143 }
144 144
145 void Log::EnableManualFlush() { 145 void Log::EnableManualFlush() {
146 if (this == NoOpLog()) { 146 if (this == NoOpLog()) {
147 return; 147 return;
148 } 148 }
149 manual_flush_++; 149 manual_flush_++;
150 } 150 }
151 151
152 void Log::DisableManualFlush() { 152 void Log::DisableManualFlush(const intptr_t cursor) {
153 if (this == NoOpLog()) { 153 if (this == NoOpLog()) {
154 return; 154 return;
155 } 155 }
156 156
157 manual_flush_--; 157 manual_flush_--;
158 ASSERT(manual_flush_ >= 0); 158 ASSERT(manual_flush_ >= 0);
159 if (manual_flush_ == 0) { 159 if (manual_flush_ == 0) {
160 Flush(); 160 Flush(cursor);
161 } 161 }
162 } 162 }
163 163
164 void LogBlock::Initialize() { 164 void LogBlock::Initialize() {
165 log_->EnableManualFlush(); 165 log_->EnableManualFlush();
166 } 166 }
167 167
168 LogBlock::~LogBlock() { 168 LogBlock::~LogBlock() {
169 log_->Flush(cursor_); 169 log_->DisableManualFlush(cursor_);
170 log_->DisableManualFlush();
171 } 170 }
172 171
173 } // namespace dart 172 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/log.h ('k') | runtime/vm/log_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698