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