| 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, |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 return nullptr; | 577 return nullptr; |
| 578 } | 578 } |
| 579 | 579 |
| 580 OperationStatus CrashReportDatabaseWin::PrepareNewCrashReport( | 580 OperationStatus CrashReportDatabaseWin::PrepareNewCrashReport( |
| 581 NewReport** report) { | 581 NewReport** report) { |
| 582 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 582 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 583 | 583 |
| 584 ::UUID system_uuid; | 584 ::UUID system_uuid; |
| 585 if (UuidCreate(&system_uuid) != RPC_S_OK) | 585 if (UuidCreate(&system_uuid) != RPC_S_OK) |
| 586 return kFileSystemError; | 586 return kFileSystemError; |
| 587 static_assert(sizeof(system_uuid) == 16, "unexpected system uuid size"); | 587 UUID uuid; |
| 588 static_assert(offsetof(::UUID, Data1) == 0, "unexpected uuid layout"); | 588 uuid.InitializeFromSystemUUID(&system_uuid); |
| 589 UUID uuid(reinterpret_cast<const uint8_t*>(&system_uuid.Data1)); | |
| 590 | 589 |
| 591 scoped_ptr<NewReportDisk> new_report(new NewReportDisk()); | 590 scoped_ptr<NewReportDisk> new_report(new NewReportDisk()); |
| 592 new_report->uuid = uuid; | 591 new_report->uuid = uuid; |
| 593 new_report->path = | 592 new_report->path = |
| 594 base_dir_.Append(kReportsDirectory) | 593 base_dir_.Append(kReportsDirectory) |
| 595 .Append(uuid.ToString16() + L"." + kCrashReportFileExtension); | 594 .Append(uuid.ToString16() + L"." + kCrashReportFileExtension); |
| 596 new_report->handle = LoggingOpenFileForWrite(new_report->path, | 595 new_report->handle = LoggingOpenFileForWrite(new_report->path, |
| 597 FileWriteMode::kCreateOrFail, | 596 FileWriteMode::kCreateOrFail, |
| 598 FilePermissions::kOwnerOnly); | 597 FilePermissions::kOwnerOnly); |
| 599 if (new_report->handle == INVALID_HANDLE_VALUE) | 598 if (new_report->handle == INVALID_HANDLE_VALUE) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 // static | 759 // static |
| 761 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize( | 760 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize( |
| 762 const base::FilePath& path) { | 761 const base::FilePath& path) { |
| 763 scoped_ptr<CrashReportDatabaseWin> database_win( | 762 scoped_ptr<CrashReportDatabaseWin> database_win( |
| 764 new CrashReportDatabaseWin(path)); | 763 new CrashReportDatabaseWin(path)); |
| 765 return database_win->Initialize() ? database_win.Pass() | 764 return database_win->Initialize() ? database_win.Pass() |
| 766 : scoped_ptr<CrashReportDatabaseWin>(); | 765 : scoped_ptr<CrashReportDatabaseWin>(); |
| 767 } | 766 } |
| 768 | 767 |
| 769 } // namespace crashpad | 768 } // namespace crashpad |
| OLD | NEW |