/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) * Copyright (C) 2004-2020 Apple Inc. All rights reserved. * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #pragma once #include "root.h" #include "EventTarget.h" #include "ExceptionOr.h" #include #include #include // #include #include #include #include #include #include #include "EventTargetConcrete.h" namespace WebCore { // The full Node type is way too much stuff // this ones just a baby class Node : public RefPtr, CanMakeWeakPtr, public EventTarget { WTF_MAKE_ISO_ALLOCATED(Node); static constexpr uint32_t s_refCountIncrement = 2; static constexpr uint32_t s_refCountMask = ~static_cast(1); public: void defaultEventHandler(Event&) { // do nothing } void handleEvent(ScriptExecutionContext&, Event&) { } bool hasEventTargetData() { return true; } void ref() const; void deref() const; bool hasOneRef() const; unsigned refCount() const; void removedLastRef() {} mutable uint32_t m_refCountAndParentBit { s_refCountIncrement }; // mutable OptionSet m_nodeFlags; }; ALWAYS_INLINE void Node::ref() const { m_refCountAndParentBit += s_refCountIncrement; } ALWAYS_INLINE void Node::deref() const { auto updatedRefCount = m_refCountAndParentBit - s_refCountIncrement; if (!updatedRefCount) { // Don't update m_refCountAndParentBit to avoid double destruction through use of Ref/RefPtr. // (This is a security mitigation in case of programmer error. It will ASSERT in debug builds.) const_cast(*this).removedLastRef(); return; } m_refCountAndParentBit = updatedRefCount; } ALWAYS_INLINE bool Node::hasOneRef() const { return refCount() == 1; } ALWAYS_INLINE unsigned Node::refCount() const { return m_refCountAndParentBit / s_refCountIncrement; } }debugger-dev Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2023-02-16faster Buffer.byteLength("latin1")Gravatar Jarred Sumner 1-36/+28
2023-02-16Support yarn-like `"workspaces"."packages": string[]` (#2086)Gravatar Jarred Sumner 2-97/+253
2023-02-16Implement `machine` for Linux (#2088)Gravatar Justin Whear 3-0/+19
2023-02-16Fix #1516 (#2089)Gravatar Justin Whear 3-7/+14
2023-02-16Update globals.d.tsGravatar Jarred Sumner 1-0/+15
2023-02-16Add missing type definitionGravatar Jarred Sumner 1-0/+2
2023-02-16[napi] Fix crash in creating arrays > 8 elements longGravatar Jarred Sumner 1-10/+9
2023-02-16Clarify and clean up macOS build process (#2087)Gravatar Luke Deen Taylor 2-4/+4
2023-02-15Don't crash on null version stringGravatar Jarred Sumner 1-1/+1
2023-02-15Add disabled optimizationGravatar Jarred Sumner 1-0/+51
2023-02-15Add more logging to napiGravatar Jarred Sumner 1-30/+150
2023-02-15Incorrect implementation of `napi_create_threadsafe_function`Gravatar Jarred Sumner 1-21/+43
2023-02-15feat(fetch) AbortSignal (#2019)Gravatar Ciro Spaciari 17-58/+443
2023-02-15fix(webcrypto): fix ed25519 CryptoKey.algorithm (#2082)Gravatar Derrick Farris 2-9/+28
2023-02-15Fix 2063 (#2079)Gravatar Justin Whear 2-2/+11
2023-02-15Make sure we test * in tesconfigGravatar Jarred Sumner 2-1/+3
2023-02-15don't return an error thereGravatar Jarred Sumner 2-1/+3
2023-02-15Fix castGravatar Jarred Sumner 1-15/+17
2023-02-15ensure we allocate for > 6 argumentsGravatar Jarred Sumner 1-6/+13
2023-02-15Update async_hooks.exports.jsGravatar Jarred Sumner 1-2/+2
2023-02-15workaround prisma's usage of `eval("__dirname")`Gravatar Jarred Sumner 1-1/+23
2023-02-15some cleanupGravatar Jarred Sumner 2-15/+9
2023-02-15ED25519 WebCrypto (#1971)Gravatar Jarred Sumner 12-11/+1167
2023-02-14Fix up async_hooks polyfillGravatar Jarred Sumner 2-8/+63
2023-02-14Add temporary polyfill for async_hooksGravatar Jarred Sumner 5-108/+324
2023-02-14:mask: async_hooksGravatar Jarred Sumner 1-0/+4
2023-02-14[install] link network-delayed `.bin` scripts correctly (#2076)Gravatar Alex Lam S.L 3-16/+21
2023-02-14don't break esbuildGravatar Jarred Sumner 7-75/+50
2023-02-14Add workaround for `tls` and `worker_threads`Gravatar Jarred Sumner 3-1/+64
2023-02-14[install] improve `package.json` validation (#2074)Gravatar Alex Lam S.L 6-104/+342
2023-02-14[WIP] fix(node:fs): export `fs.ReadStream` and `fs.WriteStream` (#1798)Gravatar Derrick Farris 4-72/+326
2023-02-14Reject with error when invalid fetch() body (#2047)Gravatar Eric Zhang 2-12/+44
2023-02-13fix(FormData): make String explicit, thanks @dylan-conway (#2065)Gravatar Derrick Farris 1-1/+1
2023-02-13fix(FormData): add string literal operator (#2064)Gravatar Derrick Farris 1-2/+2
2023-02-13Add pretty printer for FormDataGravatar Jarred Sumner 5-1/+101
2023-02-13Add dynamic port assigning to Bun.serve (#2062)Gravatar MichaƂ Warda 3-5/+40
2023-02-13feat(napi): add `napi_get_value_bigint_words` (#2061)Gravatar Derrick Farris 3-0/+44
2023-02-13Fixes https://github.com/oven-sh/bun/issues/1456Gravatar Jarred Sumner 8-1/+148