OLD | NEW |
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 Loading... |
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(const intptr_t cursor) { | 152 void Log::DisableManualFlush() { |
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(cursor); | 160 Flush(); |
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_->DisableManualFlush(cursor_); | 169 log_->Flush(cursor_); |
| 170 log_->DisableManualFlush(); |
170 } | 171 } |
171 | 172 |
172 } // namespace dart | 173 } // namespace dart |
OLD | NEW |