Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: src/log.h

Issue 108011: Introduce internal Log class that handles writing log messages, enable logging to memory buffer. (Closed)
Patch Set: Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« include/v8.h ('K') | « src/api.cc ('k') | src/log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.h
diff --git a/src/log.h b/src/log.h
index 44c1957697c7220942dce041ddba90d60cce8adf..a7c6604a178d2106e52325f326ec623a402870d6 100644
--- a/src/log.h
+++ b/src/log.h
@@ -103,10 +103,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.
@@ -201,7 +201,7 @@ class Logger {
return current_state_ ? current_state_->state() : OTHER;
}
- static bool is_enabled() { return logfile_ != NULL; }
+ static bool is_enabled();
// Pause/Resume collection of profiling data.
// When data collection is paused, Tick events are discarded until
@@ -210,6 +210,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.
@@ -223,17 +227,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_;
@@ -242,10 +235,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_;
@@ -258,7 +247,6 @@ class Logger {
// Internal implementation classes with access to
// private members.
- friend class LogMessageBuilder;
friend class EventLog;
friend class TimeLog;
friend class Profiler;
« include/v8.h ('K') | « src/api.cc ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698