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

Unified Diff: content/browser/tracing/tracing_controller_impl.cc

Issue 573963007: DCHECK written counts from fwrite to fix unused return result. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tracing/tracing_controller_impl.cc
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc
index fbff7c9036923ac50dd36e1ac4392e169cd9df0d..ded2b8596f4cb8de6fcb4b77e94c4f46bfd44dde 100644
--- a/content/browser/tracing/tracing_controller_impl.cc
+++ b/content/browser/tracing/tracing_controller_impl.cc
@@ -69,7 +69,9 @@ class FileTraceDataSink : public TracingController::TraceDataSink {
const scoped_refptr<base::RefCountedString> chunk) {
if (!OpenFileIfNeededOnFileThread())
return;
- fwrite(chunk->data().c_str(), strlen(chunk->data().c_str()), 1, file_);
+ size_t written = fwrite(chunk->data().c_str(),
+ strlen(chunk->data().c_str()), 1, file_);
+ DCHECK_EQ(1u, written);
}
bool OpenFileIfNeededOnFileThread() {
@@ -81,7 +83,8 @@ class FileTraceDataSink : public TracingController::TraceDataSink {
return false;
}
const char preamble[] = "{\"traceEvents\": [";
- fwrite(preamble, strlen(preamble), 1, file_);
+ size_t written = fwrite(preamble, strlen(preamble), 1, file_);
+ DCHECK_EQ(1u, written);
return true;
}
@@ -90,8 +93,12 @@ class FileTraceDataSink : public TracingController::TraceDataSink {
fputc(']', file_);
if (!system_trace_.empty()) {
const char systemTraceEvents[] = ",\"systemTraceEvents\": ";
- fwrite(systemTraceEvents, strlen(systemTraceEvents), 1, file_);
- fwrite(system_trace_.c_str(), strlen(system_trace_.c_str()), 1, file_);
+ 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);
}
fputc('}', file_);
base::CloseFile(file_);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698