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

Side by Side Diff: chromecast/crash/linux/minidump_writer.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
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/minidump_writer.h" 5 #include "chromecast/crash/linux/minidump_writer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chromecast/base/path_utils.h" 10 #include "chromecast/base/path_utils.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 const MinidumpParams& params) 54 const MinidumpParams& params)
55 : MinidumpWriter(minidump_generator, 55 : MinidumpWriter(minidump_generator,
56 minidump_filename, 56 minidump_filename,
57 params, 57 params,
58 base::Bind(&DumpState)) { 58 base::Bind(&DumpState)) {
59 } 59 }
60 60
61 MinidumpWriter::~MinidumpWriter() { 61 MinidumpWriter::~MinidumpWriter() {
62 } 62 }
63 63
64 int MinidumpWriter::DoWork() { 64 bool MinidumpWriter::DoWork() {
65 // If path is not absolute, append it to |dump_path_|. 65 // If path is not absolute, append it to |dump_path_|.
66 if (!minidump_path_.value().empty() && minidump_path_.value()[0] != '/') 66 if (!minidump_path_.value().empty() && minidump_path_.value()[0] != '/')
67 minidump_path_ = dump_path_.Append(minidump_path_); 67 minidump_path_ = dump_path_.Append(minidump_path_);
68 68
69 // The path should be a file in the |dump_path_| directory. 69 // The path should be a file in the |dump_path_| directory.
70 if (dump_path_ != minidump_path_.DirName()) { 70 if (dump_path_ != minidump_path_.DirName()) {
71 LOG(INFO) << "The absolute path: " << minidump_path_.value() << " is not" 71 LOG(INFO) << "The absolute path: " << minidump_path_.value() << " is not"
72 << "in the correct directory: " << dump_path_.value(); 72 << "in the correct directory: " << dump_path_.value();
73 return -1; 73 return false;
74 } 74 }
75 75
76 // Generate a minidump at the specified |minidump_path_|. 76 // Generate a minidump at the specified |minidump_path_|.
77 if (!minidump_generator_->Generate(minidump_path_.value())) { 77 if (!minidump_generator_->Generate(minidump_path_.value())) {
78 LOG(ERROR) << "Generate minidump failed " << minidump_path_.value(); 78 LOG(ERROR) << "Generate minidump failed " << minidump_path_.value();
79 return -1; 79 return false;
80 } 80 }
81 81
82 // Run the dumpstate callback. 82 // Run the dumpstate callback.
83 DCHECK(!dump_state_cb_.is_null()); 83 DCHECK(!dump_state_cb_.is_null());
84 if (dump_state_cb_.Run(minidump_path_.value()) < 0) { 84 if (dump_state_cb_.Run(minidump_path_.value()) < 0) {
85 LOG(ERROR) << "DumpState callback failed."; 85 LOG(ERROR) << "DumpState callback failed.";
86 return -1; 86 return false;
87 } 87 }
88 88
89 // Add this entry to the lockfile. 89 // Add this entry to the lockfile.
90 const DumpInfo info(minidump_path_.value(), 90 const DumpInfo info(minidump_path_.value(),
91 minidump_path_.value() + kDumpStateSuffix, 91 minidump_path_.value() + kDumpStateSuffix,
92 time(nullptr), 92 base::Time::Now(), params_);
93 params_); 93 if (!AddEntryToLockFile(info)) {
94 if (AddEntryToLockFile(info) < 0) {
95 LOG(ERROR) << "lockfile logging failed"; 94 LOG(ERROR) << "lockfile logging failed";
96 return -1; 95 return false;
97 } 96 }
98 97
99 return 0; 98 return true;
100 } 99 }
101 100
102 } // namespace crash_manager 101 } // namespace crash_manager
OLDNEW
« no previous file with comments | « chromecast/crash/linux/minidump_writer.h ('k') | chromecast/crash/linux/synchronized_minidump_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698