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 <string.h> | 17 #include <string.h> |
18 #include <time.h> | 18 #include <time.h> |
19 #include <windows.h> | 19 #include <windows.h> |
20 | 20 |
21 #include "base/logging.h" | 21 #include "base/logging.h" |
22 #include "base/numerics/safe_math.h" | 22 #include "base/numerics/safe_math.h" |
23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
26 #include "client/settings.h" | 26 #include "client/settings.h" |
27 #include "util/misc/initialization_state_dcheck.h" | 27 #include "util/misc/initialization_state_dcheck.h" |
| 28 #include "util/stdlib/move.h" |
28 | 29 |
29 namespace crashpad { | 30 namespace crashpad { |
30 | 31 |
31 namespace { | 32 namespace { |
32 | 33 |
33 const wchar_t kReportsDirectory[] = L"reports"; | 34 const wchar_t kReportsDirectory[] = L"reports"; |
34 const wchar_t kMetadataFileName[] = L"metadata"; | 35 const wchar_t kMetadataFileName[] = L"metadata"; |
35 | 36 |
36 const wchar_t kSettings[] = L"settings.dat"; | 37 const wchar_t kSettings[] = L"settings.dat"; |
37 | 38 |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 scoped_ptr<Metadata> CrashReportDatabaseWin::AcquireMetadata() { | 809 scoped_ptr<Metadata> CrashReportDatabaseWin::AcquireMetadata() { |
809 base::FilePath metadata_file = base_dir_.Append(kMetadataFileName); | 810 base::FilePath metadata_file = base_dir_.Append(kMetadataFileName); |
810 return Metadata::Create(metadata_file, base_dir_.Append(kReportsDirectory)); | 811 return Metadata::Create(metadata_file, base_dir_.Append(kReportsDirectory)); |
811 } | 812 } |
812 | 813 |
813 scoped_ptr<CrashReportDatabase> InitializeInternal( | 814 scoped_ptr<CrashReportDatabase> InitializeInternal( |
814 const base::FilePath& path, bool may_create) { | 815 const base::FilePath& path, bool may_create) { |
815 scoped_ptr<CrashReportDatabaseWin> database_win( | 816 scoped_ptr<CrashReportDatabaseWin> database_win( |
816 new CrashReportDatabaseWin(path)); | 817 new CrashReportDatabaseWin(path)); |
817 return database_win->Initialize(may_create) | 818 return database_win->Initialize(may_create) |
818 ? database_win.Pass() | 819 ? crashpad::move(database_win) |
819 : scoped_ptr<CrashReportDatabaseWin>(); | 820 : scoped_ptr<CrashReportDatabaseWin>(); |
820 } | 821 } |
821 | 822 |
822 } // namespace | 823 } // namespace |
823 | 824 |
824 // static | 825 // static |
825 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize( | 826 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize( |
826 const base::FilePath& path) { | 827 const base::FilePath& path) { |
827 return InitializeInternal(path, true); | 828 return InitializeInternal(path, true); |
828 } | 829 } |
829 | 830 |
830 // static | 831 // static |
831 scoped_ptr<CrashReportDatabase> CrashReportDatabase::InitializeWithoutCreating( | 832 scoped_ptr<CrashReportDatabase> CrashReportDatabase::InitializeWithoutCreating( |
832 const base::FilePath& path) { | 833 const base::FilePath& path) { |
833 return InitializeInternal(path, false); | 834 return InitializeInternal(path, false); |
834 } | 835 } |
835 | 836 |
836 } // namespace crashpad | 837 } // namespace crashpad |
OLD | NEW |