Avoid use of a Linux-only header in cross-platform code
Change-Id: I2df8187307260b0389c7736068e3bdf22bafd115
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2259336
Reviewed-by: Mark Mentovai <mark@chromium.org>
GitOrigin-RevId: f4b906c79c020fac7063c38970b579c862bdb3aa
diff --git a/snapshot/crashpad_types/crashpad_info_reader.cc b/snapshot/crashpad_types/crashpad_info_reader.cc
index 07a9b48..e4c8b93 100644
--- a/snapshot/crashpad_types/crashpad_info_reader.cc
+++ b/snapshot/crashpad_types/crashpad_info_reader.cc
@@ -18,9 +18,14 @@
#include "build/build_config.h"
#include "client/crashpad_info.h"
-#include "util/linux/traits.h"
#include "util/misc/as_underlying_type.h"
+#if defined(OS_WINDOWS)
+#include "util/win/traits.h"
+#elif defined(OS_LINUX) || defined(OS_ANDROID)
+#include "util/linux/traits.h"
+#endif
+
namespace crashpad {
namespace {
diff --git a/util/BUILD.gn b/util/BUILD.gn
index 6095455..388bc14 100644
--- a/util/BUILD.gn
+++ b/util/BUILD.gn
@@ -491,11 +491,13 @@
"win/scoped_local_alloc.h",
"win/scoped_process_suspend.cc",
"win/scoped_process_suspend.h",
+ "win/scoped_registry_key.h",
"win/scoped_set_event.cc",
"win/scoped_set_event.h",
"win/session_end_watcher.cc",
"win/session_end_watcher.h",
"win/termination_codes.h",
+ "win/traits.h",
"win/xp_compat.h",
]
diff --git a/util/win/traits.h b/util/win/traits.h
new file mode 100644
index 0000000..7ddf0f2
--- /dev/null
+++ b/util/win/traits.h
@@ -0,0 +1,32 @@
+// Copyright 2020 The Crashpad Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef CRASHPAD_UTIL_WIN_TRAITS_H_
+#define CRASHPAD_UTIL_WIN_TRAITS_H_
+
+#include <stdint.h>
+
+namespace crashpad {
+
+struct Traits32 {
+ using Address = DWORD;
+};
+
+struct Traits64 {
+ using Address = DWORD64;
+};
+
+} // namespace crashpad
+
+#endif // CRASHPAD_UTIL_WIN_TRAITS_H_