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

Unified Diff: src/log.cc

Issue 115859: Handle filling up of memory buffer to make log processing in DevTools Profiler easier. (Closed)
Patch Set: Created 11 years, 7 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 | « src/log.h ('k') | src/log-utils.h » ('j') | src/log-utils.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index e149fdb17a89ba80071bf76ee238df3e1159a7fc..14d1f00993d1af986760e8eab217154eb9543cae 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -813,12 +813,14 @@ void Logger::PauseProfiler() {
if (FLAG_prof_lazy) {
if (!FLAG_sliding_state_window) ticker_->Stop();
FLAG_log_code = false;
+ // Must be the same message as Log::kDynamicBufferSeal.
LOG(UncheckedStringEvent("profiler", "pause"));
}
}
void Logger::ResumeProfiler() {
+ if (!Log::IsEnabled()) return;
if (FLAG_prof_lazy) {
LOG(UncheckedStringEvent("profiler", "resume"));
FLAG_log_code = true;
@@ -829,6 +831,14 @@ void Logger::ResumeProfiler() {
}
+// This function can be called when Log's mutex is acquired,
+// either from main or Profiler's thread.
+void Logger::StopLoggingAndProfiling() {
+ Log::stop();
+ PauseProfiler();
+}
+
+
bool Logger::IsProfilerSamplerActive() {
return ticker_->IsActive();
}
@@ -995,6 +1005,8 @@ bool Logger::Setup() {
profiler_->Engage();
}
+ LogMessageBuilder::write_failure_handler = StopLoggingAndProfiling;
+
return true;
#else
@@ -1005,6 +1017,8 @@ bool Logger::Setup() {
void Logger::TearDown() {
#ifdef ENABLE_LOGGING_AND_PROFILING
+ LogMessageBuilder::write_failure_handler = NULL;
+
// Stop the profiler before closing the file.
if (profiler_ != NULL) {
profiler_->Disengage();
« no previous file with comments | « src/log.h ('k') | src/log-utils.h » ('j') | src/log-utils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698