1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 18:15:09 +00:00

AK: Really disallow making OwnPtrs from refcounted types

This looks at three things:
- if the type has a typedef `AllowOwnPtr', respect that
- if not, disallow construction if both of `ref()' and `unref()' are
  present.
Note that in the second case, if a type only defines `ref()' or only
defines `unref()', an OwnPtr can be created, as a RefPtr of that type
would be ill-formed.

Also marks a `Performance' to explicitly allow OwnPtrs.
This commit is contained in:
AnotherTest 2020-11-03 18:21:56 +03:30 committed by Andreas Kling
parent 565a26808d
commit 060ddd2a7a
4 changed files with 9 additions and 2 deletions

View file

@ -26,6 +26,7 @@
#pragma once
#include <AK/StdLibExtras.h>
#include <LibCore/ElapsedTimer.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/EventTarget.h>
@ -37,6 +38,7 @@ class Performance final
, public Bindings::Wrappable {
public:
using WrapperType = Bindings::PerformanceWrapper;
using AllowOwnPtr = AK::TrueType;
explicit Performance(DOM::Window&);
~Performance();