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

Side by Side Diff: chromecast/crash/linux/crash_util.cc

Issue 2203123003: [Chromecast] Remove usage of nonreentrant functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: slan@ comments Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « chromecast/crash/linux/crash_testing_utils.cc ('k') | chromecast/crash/linux/dump_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromecast/crash/linux/crash_util.h" 5 #include "chromecast/crash/linux/crash_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 std::unique_ptr<MinidumpWriter> writer; 61 std::unique_ptr<MinidumpWriter> writer;
62 if (g_dumpstate_cb) { 62 if (g_dumpstate_cb) {
63 writer.reset(new MinidumpWriter( 63 writer.reset(new MinidumpWriter(
64 &minidump_generator, filename.value(), params, *g_dumpstate_cb)); 64 &minidump_generator, filename.value(), params, *g_dumpstate_cb));
65 } else { 65 } else {
66 writer.reset( 66 writer.reset(
67 new MinidumpWriter(&minidump_generator, filename.value(), params)); 67 new MinidumpWriter(&minidump_generator, filename.value(), params));
68 } 68 }
69 bool success = false; 69 bool success = false;
70 writer->set_non_blocking(false);
71 success = (0 == writer->Write()); // error already logged. 70 success = (0 == writer->Write()); // error already logged.
72 71
73 // In case the file is still in $TEMP, remove it. Note that DeleteFile() will 72 // In case the file is still in $TEMP, remove it. Note that DeleteFile() will
74 // return true if |existing_minidump_path| has already been moved. 73 // return true if |existing_minidump_path| has already been moved.
75 if (!base::DeleteFile(base::FilePath(existing_minidump_path), false)) { 74 if (!base::DeleteFile(base::FilePath(existing_minidump_path), false)) {
76 LOG(ERROR) << "Unable to delete temp minidump file " 75 LOG(ERROR) << "Unable to delete temp minidump file "
77 << existing_minidump_path; 76 << existing_minidump_path;
78 success = false; 77 success = false;
79 } 78 }
80 79
81 // Use std::endl to flush the log stream in case this process exits. 80 // Use std::endl to flush the log stream in case this process exits.
82 LOG(INFO) << "Request to upload crash dump finished. " 81 LOG(INFO) << "Request to upload crash dump finished. "
83 << "Exit now if it is main process that crashed." << std::endl; 82 << "Exit now if it is main process that crashed." << std::endl;
84 83
85 // Restore the original IO restrictions on the thread, if there were any. 84 // Restore the original IO restrictions on the thread, if there were any.
86 base::ThreadRestrictions::SetIOAllowed(io_allowed); 85 base::ThreadRestrictions::SetIOAllowed(io_allowed);
87 86
88 return success; 87 return success;
89 } 88 }
90 89
91 void CrashUtil::SetDumpStateCbForTest( 90 void CrashUtil::SetDumpStateCbForTest(
92 const base::Callback<int(const std::string&)>& cb) { 91 const base::Callback<int(const std::string&)>& cb) {
93 DCHECK(!g_dumpstate_cb); 92 DCHECK(!g_dumpstate_cb);
94 g_dumpstate_cb = new base::Callback<int(const std::string&)>(cb); 93 g_dumpstate_cb = new base::Callback<int(const std::string&)>(cb);
95 } 94 }
96 95
97 } // namespace chromecast 96 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/crash/linux/crash_testing_utils.cc ('k') | chromecast/crash/linux/dump_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698