| OLD | NEW |
| 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> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/posix/global_descriptors.h" | 16 #include "base/posix/global_descriptors.h" |
| 17 #include "base/process/process.h" | 17 #include "base/process/process.h" |
| 18 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
| 19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
| 20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 21 #include "base/task_scheduler/post_task.h" | 21 #include "base/task_scheduler/post_task.h" |
| 22 #include "components/crash/content/app/breakpad_linux.h" | 22 #include "components/crash/content/app/breakpad_linux.h" |
| 23 #include "content/public/browser/child_process_data.h" | 23 #include "content/public/browser/child_process_data.h" |
| 24 #include "content/public/browser/file_descriptor_info.h" | |
| 25 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 26 #include "content/public/browser/notification_types.h" | 25 #include "content/public/browser/notification_types.h" |
| 26 #include "content/public/browser/posix_file_descriptor_info.h" |
| 27 #include "content/public/browser/render_process_host.h" | 27 #include "content/public/browser/render_process_host.h" |
| 28 #include "jni/CrashDumpManager_jni.h" | 28 #include "jni/CrashDumpManager_jni.h" |
| 29 | 29 |
| 30 namespace breakpad { | 30 namespace breakpad { |
| 31 | 31 |
| 32 CrashDumpManager::CrashDumpManager(const base::FilePath& crash_dump_dir, | 32 CrashDumpManager::CrashDumpManager(const base::FilePath& crash_dump_dir, |
| 33 int descriptor_id) | 33 int descriptor_id) |
| 34 : crash_dump_dir_(crash_dump_dir), descriptor_id_(descriptor_id) {} | 34 : crash_dump_dir_(crash_dump_dir), descriptor_id_(descriptor_id) {} |
| 35 | 35 |
| 36 CrashDumpManager::~CrashDumpManager() { | 36 CrashDumpManager::~CrashDumpManager() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 void CrashDumpManager::OnChildStart(int child_process_id, | 39 void CrashDumpManager::OnChildStart( |
| 40 content::FileDescriptorInfo* mappings) { | 40 int child_process_id, |
| 41 content::PosixFileDescriptorInfo* mappings) { |
| 41 if (!breakpad::IsCrashReporterEnabled()) | 42 if (!breakpad::IsCrashReporterEnabled()) |
| 42 return; | 43 return; |
| 43 | 44 |
| 44 base::FilePath minidump_path; | 45 base::FilePath minidump_path; |
| 45 if (!base::CreateTemporaryFile(&minidump_path)) { | 46 if (!base::CreateTemporaryFile(&minidump_path)) { |
| 46 LOG(ERROR) << "Failed to create temporary file, crash won't be reported."; | 47 LOG(ERROR) << "Failed to create temporary file, crash won't be reported."; |
| 47 return; | 48 return; |
| 48 } | 49 } |
| 49 | 50 |
| 50 // We need read permission as the minidump is generated in several phases | 51 // We need read permission as the minidump is generated in several phases |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 child_process_id_to_minidump_path_.erase(iter); | 182 child_process_id_to_minidump_path_.erase(iter); |
| 182 } | 183 } |
| 183 base::PostTaskWithTraits( | 184 base::PostTaskWithTraits( |
| 184 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, | 185 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 185 base::Bind(&CrashDumpManager::ProcessMinidump, minidump_path, | 186 base::Bind(&CrashDumpManager::ProcessMinidump, minidump_path, |
| 186 crash_dump_dir_, pid, process_type, termination_status, | 187 crash_dump_dir_, pid, process_type, termination_status, |
| 187 app_state)); | 188 app_state)); |
| 188 } | 189 } |
| 189 | 190 |
| 190 } // namespace breakpad | 191 } // namespace breakpad |
| OLD | NEW |