summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-08 17:12:59 +0000
committerpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-08 17:12:59 +0000
commit30ddaa4dec454ca3b07966c708212ce23259d4a6 (patch)
treeadf672e502315e5c31495a07b369c93250089a5a
parentbd466f307ad9b9f2b268b00cc124790b86680818 (diff)
downloadchromium_src-30ddaa4dec454ca3b07966c708212ce23259d4a6.zip
chromium_src-30ddaa4dec454ca3b07966c708212ce23259d4a6.tar.gz
chromium_src-30ddaa4dec454ca3b07966c708212ce23259d4a6.tar.bz2
Fix segmentation fault in trace_subscriber_stdio.cc.
This is part of Chrome for Android upstreaming. This crash happens when the output trace file can't be opened. It is due to the trace buffer's output callback not being set in case the file can't be opened. Even if TraceResultBuffer::Start() is not called, the output callback still needs to be set since it is used by TraceResultBuffer::AddFragment(). BUG=152867 Review URL: https://chromiumcodereview.appspot.com/11038062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160669 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/trace_subscriber_stdio.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/content/browser/trace_subscriber_stdio.cc b/content/browser/trace_subscriber_stdio.cc
index a102810..05ebaba 100644
--- a/content/browser/trace_subscriber_stdio.cc
+++ b/content/browser/trace_subscriber_stdio.cc
@@ -22,11 +22,11 @@ class TraceSubscriberStdioImpl
void OnStart() {
DCHECK(!file_);
+ trace_buffer_.SetOutputCallback(
+ base::Bind(&TraceSubscriberStdioImpl::Write, this));
file_ = file_util::OpenFile(path_, "w+");
if (IsValid()) {
LOG(INFO) << "Logging performance trace to file: " << path_.value();
- trace_buffer_.SetOutputCallback(
- base::Bind(&TraceSubscriberStdioImpl::Write, this));
trace_buffer_.Start();
} else {
LOG(ERROR) << "Failed to open performance trace file: " << path_.value();
@@ -49,7 +49,7 @@ class TraceSubscriberStdioImpl
CloseFile();
}
- bool IsValid() {
+ bool IsValid() const {
return file_ && (0 == ferror(file_));
}