| 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/breakpad/browser/crash_dump_manager_android.h" | 5 #include "components/breakpad/browser/crash_dump_manager_android.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 CrashDumpManager::~CrashDumpManager() { | 52 CrashDumpManager::~CrashDumpManager() { |
| 53 instance_ = NULL; | 53 instance_ = NULL; |
| 54 | 54 |
| 55 BrowserChildProcessObserver::Remove(this); | 55 BrowserChildProcessObserver::Remove(this); |
| 56 } | 56 } |
| 57 | 57 |
| 58 int CrashDumpManager::CreateMinidumpFile(int child_process_id) { | 58 int CrashDumpManager::CreateMinidumpFile(int child_process_id) { |
| 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER)); | 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER)); |
| 60 base::FilePath minidump_path; | 60 base::FilePath minidump_path; |
| 61 if (!file_util::CreateTemporaryFile(&minidump_path)) | 61 if (!base::CreateTemporaryFile(&minidump_path)) |
| 62 return base::kInvalidPlatformFileValue; | 62 return base::kInvalidPlatformFileValue; |
| 63 | 63 |
| 64 base::PlatformFileError error; | 64 base::PlatformFileError error; |
| 65 // We need read permission as the minidump is generated in several phases | 65 // We need read permission as the minidump is generated in several phases |
| 66 // and needs to be read at some point. | 66 // and needs to be read at some point. |
| 67 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | | 67 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | |
| 68 base::PLATFORM_FILE_WRITE; | 68 base::PLATFORM_FILE_WRITE; |
| 69 base::PlatformFile minidump_file = | 69 base::PlatformFile minidump_file = |
| 70 base::CreatePlatformFile(minidump_path, flags, NULL, &error); | 70 base::CreatePlatformFile(minidump_path, flags, NULL, &error); |
| 71 if (minidump_file == base::kInvalidPlatformFileValue) { | 71 if (minidump_file == base::kInvalidPlatformFileValue) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 minidump_path = iter->second; | 165 minidump_path = iter->second; |
| 166 child_process_id_to_minidump_path_.erase(iter); | 166 child_process_id_to_minidump_path_.erase(iter); |
| 167 } | 167 } |
| 168 BrowserThread::PostTask( | 168 BrowserThread::PostTask( |
| 169 BrowserThread::FILE, FROM_HERE, | 169 BrowserThread::FILE, FROM_HERE, |
| 170 base::Bind(&CrashDumpManager::ProcessMinidump, minidump_path, pid)); | 170 base::Bind(&CrashDumpManager::ProcessMinidump, minidump_path, pid)); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace breakpad | 173 } // namespace breakpad |
| OLD | NEW |