| 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/thread.h" | 8 #include "vm/thread.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 | 25 |
| 26 Log::~Log() { | 26 Log::~Log() { |
| 27 // Did someone enable manual flushing and then forgot to Flush? | 27 // Did someone enable manual flushing and then forgot to Flush? |
| 28 ASSERT(cursor() == 0); | 28 ASSERT(cursor() == 0); |
| 29 } | 29 } |
| 30 | 30 |
| 31 | 31 |
| 32 Log* Log::Current() { | 32 Log* Log::Current() { |
| 33 Thread* thread = Thread::Current(); | 33 Thread* thread = Thread::Current(); |
| 34 if (thread == NULL) { |
| 35 OSThread* os_thread = OSThread::Current(); |
| 36 ASSERT(os_thread != NULL); |
| 37 return os_thread->log(); |
| 38 } |
| 34 Isolate* isolate = thread->isolate(); | 39 Isolate* isolate = thread->isolate(); |
| 35 if (isolate != NULL && Log::ShouldLogForIsolate(isolate)) { | 40 if (isolate != NULL && Log::ShouldLogForIsolate(isolate)) { |
| 36 OSThread* os_thread = thread->os_thread(); | 41 OSThread* os_thread = thread->os_thread(); |
| 37 ASSERT(os_thread != NULL); | 42 ASSERT(os_thread != NULL); |
| 38 return os_thread->log(); | 43 return os_thread->log(); |
| 39 } else { | 44 } else { |
| 40 return Log::NoOpLog(); | 45 return Log::NoOpLog(); |
| 41 } | 46 } |
| 42 } | 47 } |
| 43 | 48 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 log_->EnableManualFlush(); | 178 log_->EnableManualFlush(); |
| 174 } | 179 } |
| 175 | 180 |
| 176 | 181 |
| 177 LogBlock::~LogBlock() { | 182 LogBlock::~LogBlock() { |
| 178 log_->Flush(cursor_); | 183 log_->Flush(cursor_); |
| 179 log_->DisableManualFlush(); | 184 log_->DisableManualFlush(); |
| 180 } | 185 } |
| 181 | 186 |
| 182 } // namespace dart | 187 } // namespace dart |
| OLD | NEW |