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

Unified Diff: base/files/important_file_writer.cc

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 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 | « base/files/file_path_watcher_win.cc ('k') | base/json/json_file_value_serializer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/important_file_writer.cc
diff --git a/base/files/important_file_writer.cc b/base/files/important_file_writer.cc
index d2562364dfe9cc4ed265b2c72a455a125661c606..47b0b09e8938b1ef21ffe6e45e10a71aa97587e5 100644
--- a/base/files/important_file_writer.cc
+++ b/base/files/important_file_writer.cc
@@ -10,12 +10,14 @@
#include "base/bind.h"
#include "base/critical_closure.h"
+#include "base/debug/alias.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
#include "base/task_runner.h"
#include "base/task_runner_util.h"
#include "base/threading/thread.h"
@@ -54,6 +56,20 @@ void LogFailure(const FilePath& path, TempFileFailure failure_code,
// static
bool ImportantFileWriter::WriteFileAtomically(const FilePath& path,
const std::string& data) {
+#if defined(OS_CHROMEOS)
+ // On Chrome OS, chrome gets killed when it cannot finish shutdown quickly,
+ // and this function seems to be one of the slowest shutdown steps.
+ // Include some info to the report for investigation. crbug.com/418627
+ // TODO(hashimoto): Remove this.
+ struct {
+ size_t data_size;
+ char path[128];
+ } file_info;
+ file_info.data_size = data.size();
+ base::strlcpy(file_info.path, path.value().c_str(),
+ arraysize(file_info.path));
+ base::debug::Alias(&file_info);
+#endif
// Write the data to a temp file then rename to avoid data loss if we crash
// while writing the file. Ensure that the temp file is on the same volume
// as target file, so it can be moved in one step, and that the temp file
« no previous file with comments | « base/files/file_path_watcher_win.cc ('k') | base/json/json_file_value_serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698