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

Side by Side Diff: components/crash/content/browser/crash_dump_manager_android.cc

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/crash/content/browser/crash_dump_manager_android.h" 5 #include "components/crash/content/browser/crash_dump_manager_android.h"
6 6
7 #include <stdint.h>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
9 #include "base/format_macros.h" 11 #include "base/format_macros.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
12 #include "base/posix/global_descriptors.h" 14 #include "base/posix/global_descriptors.h"
13 #include "base/process/process.h" 15 #include "base/process/process.h"
14 #include "base/rand_util.h" 16 #include "base/rand_util.h"
15 #include "base/stl_util.h" 17 #include "base/stl_util.h"
16 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 85
84 // static 86 // static
85 void CrashDumpManager::ProcessMinidump( 87 void CrashDumpManager::ProcessMinidump(
86 const base::FilePath& minidump_path, 88 const base::FilePath& minidump_path,
87 base::ProcessHandle pid, 89 base::ProcessHandle pid,
88 content::ProcessType process_type, 90 content::ProcessType process_type,
89 base::TerminationStatus termination_status, 91 base::TerminationStatus termination_status,
90 base::android::ApplicationState app_state) { 92 base::android::ApplicationState app_state) {
91 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 93 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
92 CHECK(instance_); 94 CHECK(instance_);
93 int64 file_size = 0; 95 int64_t file_size = 0;
94 int r = base::GetFileSize(minidump_path, &file_size); 96 int r = base::GetFileSize(minidump_path, &file_size);
95 DCHECK(r) << "Failed to retrieve size for minidump " 97 DCHECK(r) << "Failed to retrieve size for minidump "
96 << minidump_path.value(); 98 << minidump_path.value();
97 99
98 // TODO(wnwen): If these numbers match up to TabWebContentsObserver's 100 // TODO(wnwen): If these numbers match up to TabWebContentsObserver's
99 // TabRendererCrashStatus histogram, then remove that one as this is more 101 // TabRendererCrashStatus histogram, then remove that one as this is more
100 // accurate with more detail. 102 // accurate with more detail.
101 if (process_type == content::PROCESS_TYPE_RENDERER && 103 if (process_type == content::PROCESS_TYPE_RENDERER &&
102 app_state != base::android::APPLICATION_STATE_UNKNOWN) { 104 app_state != base::android::APPLICATION_STATE_UNKNOWN) {
103 ExitStatus renderer_exit_status; 105 ExitStatus renderer_exit_status;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 << minidump_path.value(); 142 << minidump_path.value();
141 return; 143 return;
142 } 144 }
143 145
144 // We are dealing with a valid minidump. Copy it to the crash report 146 // We are dealing with a valid minidump. Copy it to the crash report
145 // directory from where Java code will upload it later on. 147 // directory from where Java code will upload it later on.
146 if (instance_->crash_dump_dir_.empty()) { 148 if (instance_->crash_dump_dir_.empty()) {
147 NOTREACHED() << "Failed to retrieve the crash dump directory."; 149 NOTREACHED() << "Failed to retrieve the crash dump directory.";
148 return; 150 return;
149 } 151 }
150 const uint64 rand = base::RandUint64(); 152 const uint64_t rand = base::RandUint64();
151 const std::string filename = 153 const std::string filename =
152 base::StringPrintf("chromium-renderer-minidump-%016" PRIx64 ".dmp%d", 154 base::StringPrintf("chromium-renderer-minidump-%016" PRIx64 ".dmp%d",
153 rand, pid); 155 rand, pid);
154 base::FilePath dest_path = instance_->crash_dump_dir_.Append(filename); 156 base::FilePath dest_path = instance_->crash_dump_dir_.Append(filename);
155 r = base::Move(minidump_path, dest_path); 157 r = base::Move(minidump_path, dest_path);
156 if (!r) { 158 if (!r) {
157 LOG(ERROR) << "Failed to move crash dump from " << minidump_path.value() 159 LOG(ERROR) << "Failed to move crash dump from " << minidump_path.value()
158 << " to " << dest_path.value(); 160 << " to " << dest_path.value();
159 base::DeleteFile(minidump_path, false); 161 base::DeleteFile(minidump_path, false);
160 return; 162 return;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 BrowserThread::FILE, FROM_HERE, 246 BrowserThread::FILE, FROM_HERE,
245 base::Bind(&CrashDumpManager::ProcessMinidump, 247 base::Bind(&CrashDumpManager::ProcessMinidump,
246 minidump_path, 248 minidump_path,
247 pid, 249 pid,
248 process_type, 250 process_type,
249 termination_status, 251 termination_status,
250 app_state)); 252 app_state));
251 } 253 }
252 254
253 } // namespace breakpad 255 } // namespace breakpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698