| OLD | NEW |
| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 AppStateTracker::GetPreviousApp(), | 51 AppStateTracker::GetPreviousApp(), |
| 52 AppStateTracker::GetCurrentApp(), | 52 AppStateTracker::GetCurrentApp(), |
| 53 AppStateTracker::GetLastLaunchedApp(), | 53 AppStateTracker::GetLastLaunchedApp(), |
| 54 CAST_BUILD_RELEASE, | 54 CAST_BUILD_RELEASE, |
| 55 CAST_BUILD_INCREMENTAL, | 55 CAST_BUILD_INCREMENTAL, |
| 56 "" /* reason */); | 56 "" /* reason */); |
| 57 DummyMinidumpGenerator minidump_generator(existing_minidump_path); | 57 DummyMinidumpGenerator minidump_generator(existing_minidump_path); |
| 58 | 58 |
| 59 base::FilePath filename = base::FilePath(existing_minidump_path).BaseName(); | 59 base::FilePath filename = base::FilePath(existing_minidump_path).BaseName(); |
| 60 | 60 |
| 61 scoped_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); | 70 writer->set_non_blocking(false); |
| 71 success = (0 == writer->Write()); // error already logged. | 71 success = (0 == writer->Write()); // error already logged. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 88 return success; | 88 return success; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void CrashUtil::SetDumpStateCbForTest( | 91 void CrashUtil::SetDumpStateCbForTest( |
| 92 const base::Callback<int(const std::string&)>& cb) { | 92 const base::Callback<int(const std::string&)>& cb) { |
| 93 DCHECK(!g_dumpstate_cb); | 93 DCHECK(!g_dumpstate_cb); |
| 94 g_dumpstate_cb = new base::Callback<int(const std::string&)>(cb); | 94 g_dumpstate_cb = new base::Callback<int(const std::string&)>(cb); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace chromecast | 97 } // namespace chromecast |
| OLD | NEW |