|
Shaka Player Embedded
|
#include <node.h>
Public Types | |
| enum | NodeType { ELEMENT_NODE = 1, ATTRIBUTE_NODE = 2, TEXT_NODE = 3, CDATA_SECTION_NODE = 4, ENTITY_REFERENCE_NODE = 5, ENTITY_NODE = 6, PROCESSING_INSTRUCTION_NODE = 7, COMMENT_NODE = 8, DOCUMENT_NODE = 9, DOCUMENT_TYPE_NODE = 10, DOCUMENT_FRAGMENT_NODE = 11, NOTATION_NODE = 12 } |
| enum | DocumentPosition { DOCUMENT_POSITION_DISCONNECTED = 0x01, DOCUMENT_POSITION_PRECEDING = 0x02, DOCUMENT_POSITION_FOLLOWING = 0x04, DOCUMENT_POSITION_CONTAINS = 0x08, DOCUMENT_POSITION_CONTAINED_BY = 0x10, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20 } |
Public Types inherited from shaka::js::events::EventTarget | |
| using | Listener = optional< Callback > |
Public Member Functions | |
| Node (NodeType type, RefPtr< Document > document) | |
| void | Trace (memory::HeapTracer *tracer) const override |
| bool | IsShortLived () const override |
| RefPtr< Document > | document () const |
| RefPtr< Node > | parent_node () const |
| std::vector< RefPtr< Node > > | child_nodes () const |
| NodeType | node_type () const |
| virtual std::string | node_name () const =0 |
| virtual optional< std::string > | NodeValue () const =0 |
| virtual optional< std::string > | TextContent () const =0 |
| RefPtr< Node > | first_child () const |
| RefPtr< Node > | last_child () const |
| RefPtr< Node > | AppendChild (RefPtr< Node > new_child) |
| RefPtr< Node > | RemoveChild (RefPtr< Node > to_remove) |
| bool | is_document () const |
| bool | is_element () const |
| bool | is_char_data () const |
Public Member Functions inherited from shaka::js::events::EventTarget | |
| EventTarget () | |
| void | Trace (memory::HeapTracer *tracer) const override |
| void | AddEventListener (const std::string &type, Listener callback) |
| void | SetCppEventListener (EventType type, std::function< void()> callback) |
| void | RemoveEventListener (const std::string &type, Listener callback) |
| void | UnsetCppEventListener (EventType type) |
| ExceptionOr< bool > | DispatchEvent (RefPtr< Event > event) |
| ExceptionOr< bool > | DispatchEventInternal (RefPtr< Event > event, bool *did_listeners_throw) |
| template<typename EventType , typename... Args> | |
| std::shared_ptr< ThreadEvent< bool > > | ScheduleEvent (Args &&... args) |
| template<typename EventType , typename... Args> | |
| ExceptionOr< bool > | RaiseEvent (Args... args) |
Public Member Functions inherited from shaka::BackingObject | |
| BackingObject () | |
| void | Trace (memory::HeapTracer *tracer) const override |
| bool | IsRootedAlive () const override |
| std::string | name () const |
| virtual BackingObjectFactoryBase * | factory () const =0 |
| bool | DerivedFrom (const std::string &base) |
| ReturnVal< JsValue > | JsThis () const |
| void | SetJsThis (Handle< JsObject > this_) |
Public Member Functions inherited from shaka::memory::Traceable | |
| virtual | ~Traceable () |
Additional Inherited Members | |
Static Public Member Functions inherited from shaka::BackingObject | |
| static void * | operator new[] (size_t size)=delete |
| static void | operator delete[] (void *)=delete |
Static Public Attributes inherited from shaka::BackingObject | |
| static constexpr const size_t | kInternalFieldCount = 2 |
Static Public Attributes inherited from shaka::memory::Traceable | |
| static constexpr const uint64_t | kShortLiveDurationMs = 5000 |
Protected Member Functions inherited from shaka::js::events::EventTarget | |
| void | AddListenerField (EventType type, Listener *on_field) |
Protected Member Functions inherited from shaka::BackingObject | |
| ~BackingObject () override | |
Implements the Node interface for DOM. https://dom.spec.whatwg.org/#interface-node
IMPORTANT: This does not implement any event firing. Because the player only uses XML parsing, it does not need it. Meaning that altering the DOM tree will not result in any mutation events.
This also does not implement shadow-DOM.
The DOM spec says that Nodes should return the same objects, namely that adding a field to a node should persist. However, here we do not persist backing objects if they are not used.
The above should work, but may not because the GC will collect the firstCild wrapper (JavaScript) object since it has no references.
|
overridevirtual |
Gets whether the object is considered short-lived. This means that once the C++ ref-count is zero, the object won't remain alive for long. It is important to only set this if the JavaScript object won't be used for long.
This exists for JSC which doesn't offer a way for us to track whether a JavaScript object is still alive. If the JavaScript object is used after the backing object is destroyed, then a JavaScript exception will be thrown.
Reimplemented from shaka::memory::Traceable.
|
pure virtual |
Implemented in shaka::js::dom::Document, shaka::js::dom::Attr, shaka::js::dom::Element, shaka::js::dom::Comment, and shaka::js::dom::Text.
|
pure virtual |
Implemented in shaka::js::dom::Document, shaka::js::dom::Attr, shaka::js::dom::Element, and shaka::js::dom::CharacterData.
|
pure virtual |
Implemented in shaka::js::dom::Document, shaka::js::dom::Attr, shaka::js::dom::Element, and shaka::js::dom::CharacterData.
|
overridevirtual |
Called during a GC run. This should call HeapTracer::Trace on all Traceable members. Be sure to call the base method when overriding.
Implements shaka::memory::Traceable.
Reimplemented in shaka::js::mse::HTMLMediaElement.
1.8.13