Bug 1601792: Remove VMSharingPolicyShared's template parameters and use inline variables instead; r=handyman

Differential Revision: https://phabricator.services.mozilla.com/D83573
This commit is contained in:
Aaron Klotz 2020-07-15 17:43:30 +00:00
parent d47eab04ae
commit 010f090320
2 changed files with 5 additions and 21 deletions

View File

@ -185,18 +185,10 @@ class VMSharingPolicyUnique : public MMPolicy {
namespace mozilla {
namespace interceptor {
template <typename MMPolicy, bool Dummy>
class VMSharingPolicyShared;
// We only support this policy for in-proc MMPolicy.
// Dummy is not actually needed for the implementation, but we need this
// to be a partial specialization so that its statics are treated as inlines
// (At least until we have C++17 enabled by default)
template <bool Dummy>
class MOZ_TRIVIAL_CTOR_DTOR VMSharingPolicyShared<MMPolicyInProcess, Dummy>
: public MMPolicyInProcess {
class MOZ_TRIVIAL_CTOR_DTOR VMSharingPolicyShared : public MMPolicyInProcess {
typedef VMSharingPolicyUnique<MMPolicyInProcess> UniquePolicyT;
typedef VMSharingPolicyShared<MMPolicyInProcess, Dummy> ThisType;
typedef VMSharingPolicyShared ThisType;
public:
using PoolType = TrampolinePool<ThisType, UniquePolicyT::PoolType>;
@ -283,17 +275,10 @@ class MOZ_TRIVIAL_CTOR_DTOR VMSharingPolicyShared<MMPolicyInProcess, Dummy>
template <typename VMPolicyT, typename InnerT>
friend class TrampolinePool;
static RangeMap<MMPolicyInProcess> sVMMap;
static CRITICAL_SECTION sCS;
inline static RangeMap<MMPolicyInProcess> sVMMap;
inline static CRITICAL_SECTION sCS;
};
template <bool Dummy>
RangeMap<MMPolicyInProcess>
VMSharingPolicyShared<MMPolicyInProcess, Dummy>::sVMMap;
template <bool Dummy>
CRITICAL_SECTION VMSharingPolicyShared<MMPolicyInProcess, Dummy>::sCS;
} // namespace interceptor
} // namespace mozilla

View File

@ -287,8 +287,7 @@ struct TypeResolver<mozilla::interceptor::MMPolicyOutOfProcess, InterceptorT> {
using FuncHookType = FuncHookCrossProcess<InterceptorT, FuncPtrT>;
};
template <typename VMPolicy = mozilla::interceptor::VMSharingPolicyShared<
mozilla::interceptor::MMPolicyInProcess, true>>
template <typename VMPolicy = mozilla::interceptor::VMSharingPolicyShared>
class WindowsDllInterceptor final
: public TypeResolver<typename VMPolicy::MMPolicyT,
WindowsDllInterceptor<VMPolicy>> {