summaryrefslogtreecommitdiffstats
path: root/content/browser/tracing/tracing_controller_impl.cc
diff options
context:
space:
mode:
authorflackr <flackr@chromium.org>2014-09-17 11:14:00 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-17 18:14:13 +0000
commitea6f57280608d4d5dd9973863645fe9f17f9b829 (patch)
tree3db7f00ede3b6f574ec57a657c03a3720c901e13 /content/browser/tracing/tracing_controller_impl.cc
parent99c9e74adf038e56ab9d37b6949baebbc5e504a0 (diff)
downloadchromium_src-ea6f57280608d4d5dd9973863645fe9f17f9b829.zip
chromium_src-ea6f57280608d4d5dd9973863645fe9f17f9b829.tar.gz
chromium_src-ea6f57280608d4d5dd9973863645fe9f17f9b829.tar.bz2
Ignore fwrite results in tracing controller.
As per caseq's comment in https://codereview.chromium.org/573963007/ we should ignore the write result. BUG=382975 TEST=Compile does not warn about / error on unused fwrite result. Review URL: https://codereview.chromium.org/578853002 Cr-Commit-Position: refs/heads/master@{#295302}
Diffstat (limited to 'content/browser/tracing/tracing_controller_impl.cc')
-rw-r--r--content/browser/tracing/tracing_controller_impl.cc19
1 files changed, 8 insertions, 11 deletions
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc
index ded2b85..73c4857 100644
--- a/content/browser/tracing/tracing_controller_impl.cc
+++ b/content/browser/tracing/tracing_controller_impl.cc
@@ -7,6 +7,7 @@
#include "base/debug/trace_event.h"
#include "base/files/file_util.h"
#include "base/json/string_escape.h"
+#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "content/browser/tracing/trace_message_filter.h"
#include "content/browser/tracing/tracing_ui.h"
@@ -69,9 +70,8 @@ class FileTraceDataSink : public TracingController::TraceDataSink {
const scoped_refptr<base::RefCountedString> chunk) {
if (!OpenFileIfNeededOnFileThread())
return;
- size_t written = fwrite(chunk->data().c_str(),
- strlen(chunk->data().c_str()), 1, file_);
- DCHECK_EQ(1u, written);
+ ignore_result(fwrite(chunk->data().c_str(), strlen(chunk->data().c_str()),
+ 1, file_));
}
bool OpenFileIfNeededOnFileThread() {
@@ -83,8 +83,7 @@ class FileTraceDataSink : public TracingController::TraceDataSink {
return false;
}
const char preamble[] = "{\"traceEvents\": [";
- size_t written = fwrite(preamble, strlen(preamble), 1, file_);
- DCHECK_EQ(1u, written);
+ ignore_result(fwrite(preamble, strlen(preamble), 1, file_));
return true;
}
@@ -93,12 +92,10 @@ class FileTraceDataSink : public TracingController::TraceDataSink {
fputc(']', file_);
if (!system_trace_.empty()) {
const char systemTraceEvents[] = ",\"systemTraceEvents\": ";
- size_t written = fwrite(systemTraceEvents, strlen(systemTraceEvents),
- 1, file_);
- DCHECK_EQ(1u, written);
- written = fwrite(system_trace_.c_str(),
- strlen(system_trace_.c_str()), 1, file_);
- DCHECK_EQ(1u, written);
+ ignore_result(fwrite(systemTraceEvents, strlen(systemTraceEvents),
+ 1, file_));
+ ignore_result(fwrite(system_trace_.c_str(),
+ strlen(system_trace_.c_str()), 1, file_));
}
fputc('}', file_);
base::CloseFile(file_);