Commit a00a9142 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

Revert "[logging] Use OFStream for log events"

This reverts commit 06ff9e97.

Reason for revert: Breaks deopt information with --prof. Deopts no longer show up properly in the logfile / profview

Original change's description:
> [logging] Use OFStream for log events
> 
> This simplifies a few operations and removes the size limitations
> implied by the message buffer used.
> 
> Change-Id: I8b873a0ffa399a037ff5c2501ba4b68158810968
> Reviewed-on: https://chromium-review.googlesource.com/724285
> Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#48766}

TBR=adamk@chromium.org,cbruni@chromium.org

Change-Id: I290da0b2472ad0e765b765b26bdde334253376e3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/730164Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48776}
parent f0aa474e
This diff is collapsed.
......@@ -13,7 +13,6 @@
#include "src/base/compiler-specific.h"
#include "src/base/platform/mutex.h"
#include "src/flags.h"
#include "src/ostreams.h"
namespace v8 {
namespace internal {
......@@ -23,7 +22,8 @@ class Logger;
// Functions and data for performing output of log messages.
class Log {
public:
Log(Logger* log, const char* log_file_name);
// Performs process-wide initialization.
void Initialize(const char* log_file_name);
// Disables logging, but preserves acquired resources.
void stop() { is_stopped_ = true; }
......@@ -66,9 +66,11 @@ class Log {
// Append string data to the log message.
void PRINTF_FORMAT(2, 0) AppendVA(const char* format, va_list args);
// Append a character to the log message.
void Append(const char c);
// Append double quoted string to the log message.
void AppendDoubleQuotedString(const char* string);
void AppendDoubleQuotedString(String* string);
// Append a heap string.
void Append(String* str);
......@@ -86,32 +88,37 @@ class Log {
// Helpers for appending char, C-string and heap string without
// buffering. This is useful for entries that can exceed the 2kB
// limit.
void AppendEscapedString(String* source);
void AppendEscapedString(String* source, int len);
// Delegate insertion to the underlying {log_}.
template <typename T>
MessageBuilder& operator<<(T value) {
log_->os_ << value;
return *this;
}
void AppendUnbufferedChar(char c);
void AppendUnbufferedCString(const char* str);
void AppendUnbufferedHeapString(String* source);
// Finish the current log line an flush the it to the log file.
// Write the log message to the log file currently opened.
void WriteToLogFile();
private:
Log* log_;
base::LockGuard<base::Mutex> lock_guard_;
int pos_;
};
private:
static FILE* CreateOutputHandle(const char* file_name);
explicit Log(Logger* logger);
// Opens stdout for logging.
void OpenStdout();
// Opens file for logging.
void OpenFile(const char* name);
// Opens a temporary file for logging.
void OpenTemporaryFile();
// Implementation of writing to a log file.
int WriteToFile(const char* msg, int length) {
DCHECK_NOT_NULL(output_handle_);
os_.write(msg, length);
DCHECK(!os_.bad());
size_t rv = fwrite(msg, 1, length, output_handle_);
DCHECK_EQ(length, rv);
USE(rv);
return length;
}
......@@ -121,7 +128,6 @@ class Log {
// When logging is active output_handle_ is used to store a pointer to log
// destination. mutex_ should be acquired before using output_handle_.
FILE* output_handle_;
OFStream os_;
// mutex_ is a Mutex used for enforcing exclusive
// access to the formatting buffer and the log file or log memory buffer.
......@@ -129,7 +135,7 @@ class Log {
// Buffer used for formatting log messages. This is a singleton buffer and
// mutex_ should be acquired before using it.
char* format_buffer_;
char* message_buffer_;
Logger* logger_;
......
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