| OLD | NEW |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #include "client/crash_report_database.h" | 15 #include "client/crash_report_database.h" |
| 16 | 16 |
| 17 #include <rpc.h> | |
| 18 #include <string.h> | 17 #include <string.h> |
| 19 #include <time.h> | 18 #include <time.h> |
| 20 #include <windows.h> | 19 #include <windows.h> |
| 21 | 20 |
| 22 #include "base/logging.h" | 21 #include "base/logging.h" |
| 23 #include "base/numerics/safe_math.h" | 22 #include "base/numerics/safe_math.h" |
| 24 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 25 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 26 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 27 #include "util/misc/initialization_state_dcheck.h" | 26 #include "util/misc/initialization_state_dcheck.h" |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 | 565 |
| 567 // Port to Win https://code.google.com/p/crashpad/issues/detail?id=13. | 566 // Port to Win https://code.google.com/p/crashpad/issues/detail?id=13. |
| 568 NOTREACHED(); | 567 NOTREACHED(); |
| 569 return nullptr; | 568 return nullptr; |
| 570 } | 569 } |
| 571 | 570 |
| 572 OperationStatus CrashReportDatabaseWin::PrepareNewCrashReport( | 571 OperationStatus CrashReportDatabaseWin::PrepareNewCrashReport( |
| 573 NewReport** report) { | 572 NewReport** report) { |
| 574 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 573 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 575 | 574 |
| 576 ::UUID system_uuid; | 575 scoped_ptr<NewReport> new_report(new NewReport()); |
| 577 if (UuidCreate(&system_uuid) != RPC_S_OK) | 576 if (!new_report->uuid.InitializeWithNew()) |
| 578 return kFileSystemError; | 577 return kFileSystemError; |
| 579 | |
| 580 scoped_ptr<NewReport> new_report(new NewReport()); | |
| 581 new_report->uuid.InitializeFromSystemUUID(&system_uuid); | |
| 582 new_report->path = base_dir_.Append(kReportsDirectory) | 578 new_report->path = base_dir_.Append(kReportsDirectory) |
| 583 .Append(new_report->uuid.ToString16() + L"." + | 579 .Append(new_report->uuid.ToString16() + L"." + |
| 584 kCrashReportFileExtension); | 580 kCrashReportFileExtension); |
| 585 new_report->handle = LoggingOpenFileForWrite(new_report->path, | 581 new_report->handle = LoggingOpenFileForWrite(new_report->path, |
| 586 FileWriteMode::kCreateOrFail, | 582 FileWriteMode::kCreateOrFail, |
| 587 FilePermissions::kOwnerOnly); | 583 FilePermissions::kOwnerOnly); |
| 588 if (new_report->handle == INVALID_HANDLE_VALUE) | 584 if (new_report->handle == INVALID_HANDLE_VALUE) |
| 589 return kFileSystemError; | 585 return kFileSystemError; |
| 590 | 586 |
| 591 *report = new_report.release(); | 587 *report = new_report.release(); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 // static | 745 // static |
| 750 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize( | 746 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize( |
| 751 const base::FilePath& path) { | 747 const base::FilePath& path) { |
| 752 scoped_ptr<CrashReportDatabaseWin> database_win( | 748 scoped_ptr<CrashReportDatabaseWin> database_win( |
| 753 new CrashReportDatabaseWin(path)); | 749 new CrashReportDatabaseWin(path)); |
| 754 return database_win->Initialize() ? database_win.Pass() | 750 return database_win->Initialize() ? database_win.Pass() |
| 755 : scoped_ptr<CrashReportDatabaseWin>(); | 751 : scoped_ptr<CrashReportDatabaseWin>(); |
| 756 } | 752 } |
| 757 | 753 |
| 758 } // namespace crashpad | 754 } // namespace crashpad |
| OLD | NEW |