Index: src/log.h |
diff --git a/src/log.h b/src/log.h |
index bbcfa42c63b7471ddbd31cdd55d6092003676d46..e579361fe86fbfd767e01b6b83b51beaabed01f3 100644 |
--- a/src/log.h |
+++ b/src/log.h |
@@ -28,7 +28,8 @@ |
#ifndef V8_LOG_H_ |
#define V8_LOG_H_ |
-namespace v8 { namespace internal { |
+namespace v8 { |
+namespace internal { |
// Logger is used for collecting logging information from V8 during |
// execution. The result is dumped to a file. |
@@ -75,7 +76,7 @@ class LogMessageBuilder; |
#ifdef ENABLE_LOGGING_AND_PROFILING |
#define LOG(Call) \ |
do { \ |
- if (v8::internal::Logger::is_enabled()) \ |
+ if (v8::internal::Logger::IsEnabled()) \ |
v8::internal::Logger::Call; \ |
} while (false) |
#else |
@@ -103,10 +104,10 @@ class VMState BASE_EMBEDDED { |
class Logger { |
public: |
- // Opens the file for logging if the right flags are set. |
+ // Acquires resources for logging if the right flags are set. |
static bool Setup(); |
- // Closes file opened in Setup. |
+ // Frees resources acquired in Setup. |
static void TearDown(); |
// Enable the computation of a sliding window of states. |
@@ -206,7 +207,7 @@ class Logger { |
return current_state_ ? current_state_->state() : OTHER; |
} |
- static bool is_enabled() { return logfile_ != NULL; } |
+ static bool IsEnabled(); |
// Pause/Resume collection of profiling data. |
// When data collection is paused, Tick events are discarded until |
@@ -215,6 +216,10 @@ class Logger { |
static void PauseProfiler(); |
static void ResumeProfiler(); |
+ // If logging is performed into a memory buffer, allows to |
+ // retrieve previously written messages. See v8.h. |
+ static int GetLogLines(int from_pos, char* dest_buf, int max_size); |
+ |
private: |
// Emits the source code of a regexp. Used by regexp events. |
@@ -228,17 +233,6 @@ class Logger { |
// Logs a StringEvent regardless of whether FLAG_log is true. |
static void UncheckedStringEvent(const char* name, const char* value); |
- // Size of buffer used for formatting log messages. |
- static const int kMessageBufferSize = 2048; |
- |
- // Buffer used for formatting log messages. This is a singleton buffer and |
- // mutex_ should be acquired before using it. |
- static char* message_buffer_; |
- |
- // When logging is active, logfile_ refers the file events are written to. |
- // mutex_ should be acquired before using logfile_. |
- static FILE* logfile_; |
- |
// The sampler used by the profiler and the sliding state window. |
static Ticker* ticker_; |
@@ -247,10 +241,6 @@ class Logger { |
// of samples. |
static Profiler* profiler_; |
- // mutex_ is a Mutex used for enforcing exclusive |
- // access to the formatting buffer and the log file. |
- static Mutex* mutex_; |
- |
// A stack of VM states. |
static VMState* current_state_; |
@@ -263,7 +253,6 @@ class Logger { |
// Internal implementation classes with access to |
// private members. |
- friend class LogMessageBuilder; |
friend class EventLog; |
friend class TimeLog; |
friend class Profiler; |
@@ -286,7 +275,7 @@ class StackTracer BASE_EMBEDDED { |
unsigned int low_stack_bound_; |
}; |
- |
-} } // namespace v8::internal |
+} // namespace internal |
+} // namespace v8 |
#endif // V8_LOG_H_ |