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

Unified Diff: test/cctest/test-log.cc

Issue 844006: Merge changes up to V8 version 2.1.3 into the partial snapshots (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 years, 9 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
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-log.cc
===================================================================
--- test/cctest/test-log.cc (revision 3964)
+++ test/cctest/test-log.cc (working copy)
@@ -174,12 +174,11 @@
class ScopedLoggerInitializer {
public:
- explicit ScopedLoggerInitializer(bool log, bool prof_lazy)
- : saved_log_(i::FLAG_log),
- saved_prof_lazy_(i::FLAG_prof_lazy),
+ explicit ScopedLoggerInitializer(bool prof_lazy)
+ : saved_prof_lazy_(i::FLAG_prof_lazy),
saved_prof_(i::FLAG_prof),
saved_prof_auto_(i::FLAG_prof_auto),
- trick_to_run_init_flags_(init_flags_(log, prof_lazy)),
+ trick_to_run_init_flags_(init_flags_(prof_lazy)),
need_to_set_up_logger_(i::V8::IsRunning()),
scope_(),
env_(v8::Context::New()) {
@@ -193,14 +192,12 @@
i::FLAG_prof_lazy = saved_prof_lazy_;
i::FLAG_prof = saved_prof_;
i::FLAG_prof_auto = saved_prof_auto_;
- i::FLAG_log = saved_log_;
}
v8::Handle<v8::Context>& env() { return env_; }
private:
- static bool init_flags_(bool log, bool prof_lazy) {
- i::FLAG_log = log;
+ static bool init_flags_(bool prof_lazy) {
i::FLAG_prof = true;
i::FLAG_prof_lazy = prof_lazy;
i::FLAG_prof_auto = false;
@@ -208,7 +205,6 @@
return prof_lazy;
}
- const bool saved_log_;
const bool saved_prof_lazy_;
const bool saved_prof_;
const bool saved_prof_auto_;
@@ -320,7 +316,7 @@
TEST(ProfLazyMode) {
- ScopedLoggerInitializer initialize_logger(false, true);
+ ScopedLoggerInitializer initialize_logger(true);
// No sampling should happen prior to resuming profiler.
CHECK(!LoggerTestHelper::IsSamplerActive());
@@ -394,19 +390,19 @@
class LoopingJsThread : public LoopingThread {
public:
void RunLoop() {
- {
- v8::Locker locker;
- CHECK(v8::internal::ThreadManager::HasId());
- SetV8ThreadId();
- }
+ v8::Locker locker;
+ CHECK(v8::internal::ThreadManager::HasId());
+ SetV8ThreadId();
while (IsRunning()) {
- v8::Locker locker;
v8::HandleScope scope;
v8::Persistent<v8::Context> context = v8::Context::New();
- v8::Context::Scope context_scope(context);
- SignalRunning();
- CompileAndRunScript(
- "var j; for (var i=0; i<10000; ++i) { j = Math.sin(i); }");
+ CHECK(!context.IsEmpty());
+ {
+ v8::Context::Scope context_scope(context);
+ SignalRunning();
+ CompileAndRunScript(
+ "var j; for (var i=0; i<10000; ++i) { j = Math.sin(i); }");
+ }
context.Dispose();
i::OS::Sleep(1);
}
@@ -540,7 +536,7 @@
}
TEST(LogCallbacks) {
- ScopedLoggerInitializer initialize_logger(false, false);
+ ScopedLoggerInitializer initialize_logger(false);
LogBufferMatcher matcher;
v8::Persistent<v8::FunctionTemplate> obj =
@@ -590,7 +586,7 @@
}
TEST(LogAccessorCallbacks) {
- ScopedLoggerInitializer initialize_logger(false, false);
+ ScopedLoggerInitializer initialize_logger(false);
LogBufferMatcher matcher;
v8::Persistent<v8::FunctionTemplate> obj =
@@ -625,7 +621,7 @@
TEST(LogTags) {
- ScopedLoggerInitializer initialize_logger(true, false);
+ ScopedLoggerInitializer initialize_logger(false);
LogBufferMatcher matcher;
const char* open_tag = "open-tag,";
@@ -710,6 +706,35 @@
}
+TEST(IsLoggingPreserved) {
+ ScopedLoggerInitializer initialize_logger(false);
+
+ CHECK(Logger::is_logging());
+ Logger::ResumeProfiler(v8::PROFILER_MODULE_CPU, 1);
+ CHECK(Logger::is_logging());
+ Logger::PauseProfiler(v8::PROFILER_MODULE_CPU, 1);
+ CHECK(Logger::is_logging());
+
+ CHECK(Logger::is_logging());
+ Logger::ResumeProfiler(
+ v8::PROFILER_MODULE_HEAP_STATS | v8::PROFILER_MODULE_JS_CONSTRUCTORS, 1);
+ CHECK(Logger::is_logging());
+ Logger::PauseProfiler(
+ v8::PROFILER_MODULE_HEAP_STATS | v8::PROFILER_MODULE_JS_CONSTRUCTORS, 1);
+ CHECK(Logger::is_logging());
+
+ CHECK(Logger::is_logging());
+ Logger::ResumeProfiler(
+ v8::PROFILER_MODULE_CPU |
+ v8::PROFILER_MODULE_HEAP_STATS | v8::PROFILER_MODULE_JS_CONSTRUCTORS, 1);
+ CHECK(Logger::is_logging());
+ Logger::PauseProfiler(
+ v8::PROFILER_MODULE_CPU |
+ v8::PROFILER_MODULE_HEAP_STATS | v8::PROFILER_MODULE_JS_CONSTRUCTORS, 1);
+ CHECK(Logger::is_logging());
+}
+
+
static inline bool IsStringEqualTo(const char* r, const char* s) {
return strncmp(r, s, strlen(r)) == 0;
}
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698