Return immediately from GetLogLines if logging to memory isn't enabled.
Review URL: http://codereview.chromium.org/115123 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1901 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
d6a506c66e
commit
ebdf1d1e5b
@ -423,6 +423,7 @@ void Log::Close() {
|
|||||||
|
|
||||||
|
|
||||||
int Log::GetLogLines(int from_pos, char* dest_buf, int max_size) {
|
int Log::GetLogLines(int from_pos, char* dest_buf, int max_size) {
|
||||||
|
if (Write != WriteToMemory) return 0;
|
||||||
ASSERT(output_.buffer != NULL);
|
ASSERT(output_.buffer != NULL);
|
||||||
ASSERT(output_buffer_write_pos_ >= output_.buffer);
|
ASSERT(output_buffer_write_pos_ >= output_.buffer);
|
||||||
ASSERT(from_pos >= 0);
|
ASSERT(from_pos >= 0);
|
||||||
|
@ -23,6 +23,7 @@ static void TearDown() {
|
|||||||
Logger::TearDown();
|
Logger::TearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(EmptyLog) {
|
TEST(EmptyLog) {
|
||||||
SetUp();
|
SetUp();
|
||||||
CHECK_EQ(0, Logger::GetLogLines(0, NULL, 0));
|
CHECK_EQ(0, Logger::GetLogLines(0, NULL, 0));
|
||||||
@ -99,4 +100,18 @@ TEST(BeyondWritePosition) {
|
|||||||
TearDown();
|
TearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(MemoryLoggingTurnedOff) {
|
||||||
|
// Log to stdout
|
||||||
|
v8::internal::FLAG_logfile = "-";
|
||||||
|
v8::internal::FLAG_log = true;
|
||||||
|
Logger::Setup();
|
||||||
|
CHECK_EQ(0, Logger::GetLogLines(0, NULL, 0));
|
||||||
|
CHECK_EQ(0, Logger::GetLogLines(100, NULL, 0));
|
||||||
|
CHECK_EQ(0, Logger::GetLogLines(0, NULL, 100));
|
||||||
|
CHECK_EQ(0, Logger::GetLogLines(100, NULL, 100));
|
||||||
|
Logger::TearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // ENABLE_LOGGING_AND_PROFILING
|
#endif // ENABLE_LOGGING_AND_PROFILING
|
||||||
|
Loading…
Reference in New Issue
Block a user