diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/runtime/PrivateName.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/runtime/PrivateName.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/PrivateName.h | 39 |
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 |