summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/PrivateName.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/runtime/PrivateName.h')
-rw-r--r--Source/JavaScriptCore/runtime/PrivateName.h39
1 files changed, 26 insertions, 13 deletions
diff --git a/Source/JavaScriptCore/runtime/PrivateName.h b/Source/JavaScriptCore/runtime/PrivateName.h
index 5d2774a20..ea43ff15f 100644
--- a/Source/JavaScriptCore/runtime/PrivateName.h
+++ b/Source/JavaScriptCore/runtime/PrivateName.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,31 +23,44 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef PrivateName_h
-#define PrivateName_h
+#pragma once
-#include <wtf/text/StringImpl.h>
+#include <wtf/text/SymbolImpl.h>
namespace JSC {
class PrivateName {
public:
PrivateName()
- : m_impl(StringImpl::createEmptyUnique())
+ : m_uid(SymbolImpl::createNullSymbol())
{
}
- explicit PrivateName(StringImpl* uid)
- : m_impl(uid)
+
+ explicit PrivateName(SymbolImpl& uid)
+ : m_uid(uid)
+ {
+ }
+
+ enum DescriptionTag { Description };
+ explicit PrivateName(DescriptionTag, const String& description)
+ : m_uid(SymbolImpl::create(*description.impl()))
+ {
+ }
+
+ PrivateName(const PrivateName& privateName)
+ : m_uid(privateName.m_uid.copyRef())
{
- ASSERT(m_impl->isEmptyUnique());
}
- StringImpl* uid() const { return m_impl.get(); }
+ PrivateName(PrivateName&&) = default;
+
+ SymbolImpl& uid() const { return m_uid; }
+
+ bool operator==(const PrivateName& other) const { return &uid() == &other.uid(); }
+ bool operator!=(const PrivateName& other) const { return &uid() != &other.uid(); }
private:
- RefPtr<StringImpl> m_impl;
+ Ref<SymbolImpl> m_uid;
};
-}
-
-#endif
+} // namespace JSC