Commit cc9a9f41 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Ensure that each profiling entry ends with a new line.

Currently this does not happen if the message builder buffer is full.

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/390803002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22368 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4493756d
......@@ -219,6 +219,10 @@ void Log::MessageBuilder::AppendStringPart(const char* str, int len) {
void Log::MessageBuilder::WriteToLogFile() {
ASSERT(pos_ <= Log::kMessageBufferSize);
// Assert that we do not already have a new line at the end.
ASSERT(pos_ == 0 || log_->message_buffer_[pos_ - 1] != '\n');
if (pos_ == Log::kMessageBufferSize) pos_--;
log_->message_buffer_[pos_++] = '\n';
const int written = log_->WriteToFile(log_->message_buffer_, pos_);
if (written != pos_) {
log_->stop();
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment