Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: snapshot/mac/process_types/custom.cc

Issue 1274663005: Provide a properly-typed ExpectedSizeForVersion() for types that need it (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: snapshot/mac/process_types/custom.cc
diff --git a/snapshot/mac/process_types/custom.cc b/snapshot/mac/process_types/custom.cc
index ba055c0e8573138701f2d038ecd029195b2cd667..6d6fd0db3e13a301bfc2fde7c475b87ffeccdf9f 100644
--- a/snapshot/mac/process_types/custom.cc
+++ b/snapshot/mac/process_types/custom.cc
@@ -24,6 +24,8 @@ namespace crashpad {
namespace process_types {
namespace internal {
+namespace {
+
template <typename T>
bool ReadIntoVersioned(ProcessReader* process_reader,
mach_vm_address_t address,
@@ -51,9 +53,12 @@ bool ReadIntoVersioned(ProcessReader* process_reader,
return true;
}
+} // namespace
+
// static
template <typename Traits>
-size_t dyld_all_image_infos<Traits>::ExpectedSizeForVersion(uint64_t version) {
+size_t dyld_all_image_infos<Traits>::ExpectedSizeForVersion(
+ decltype(dyld_all_image_infos<Traits>::version) version) {
if (version >= 14) {
return sizeof(dyld_all_image_infos<Traits>);
}
@@ -108,7 +113,7 @@ bool dyld_all_image_infos<Traits>::ReadInto(
// static
template <typename Traits>
size_t crashreporter_annotations_t<Traits>::ExpectedSizeForVersion(
- uint64_t version) {
+ decltype(crashreporter_annotations_t<Traits>::version) version) {
if (version >= 5) {
return sizeof(crashreporter_annotations_t<Traits>);
}
@@ -127,16 +132,18 @@ bool crashreporter_annotations_t<Traits>::ReadInto(
return ReadIntoVersioned(process_reader, address, specific);
}
+// Explicit template instantiation of the above.
#define PROCESS_TYPE_FLAVOR_TRAITS(lp_bits) \
template size_t \
- dyld_all_image_infos<Traits##lp_bits>::ExpectedSizeForVersion(uint64_t); \
+ dyld_all_image_infos<Traits##lp_bits>::ExpectedSizeForVersion( \
+ decltype(dyld_all_image_infos<Traits##lp_bits>::version)); \
template bool dyld_all_image_infos<Traits##lp_bits>::ReadInto( \
ProcessReader*, \
mach_vm_address_t, \
dyld_all_image_infos<Traits##lp_bits>*); \
template size_t \
crashreporter_annotations_t<Traits##lp_bits>::ExpectedSizeForVersion( \
- uint64_t); \
+ decltype(crashreporter_annotations_t<Traits##lp_bits>::version)); \
template bool crashreporter_annotations_t<Traits##lp_bits>::ReadInto( \
ProcessReader*, \
mach_vm_address_t, \
« no previous file with comments | « snapshot/mac/process_types/crashreporterclient.proctype ('k') | snapshot/mac/process_types/dyld_images.proctype » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698