PerformanceObserverEntryList.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Bindings/PlatformObject.h>
  8. namespace Web::PerformanceTimeline {
  9. // https://w3c.github.io/performance-timeline/#performanceobserverentrylist-interface
  10. class PerformanceObserverEntryList final : public Bindings::PlatformObject {
  11. WEB_PLATFORM_OBJECT(PerformanceObserverEntryList, Bindings::PlatformObject);
  12. public:
  13. virtual ~PerformanceObserverEntryList() override;
  14. WebIDL::ExceptionOr<Vector<JS::Handle<PerformanceTimeline::PerformanceEntry>>> get_entries() const;
  15. WebIDL::ExceptionOr<Vector<JS::Handle<PerformanceTimeline::PerformanceEntry>>> get_entries_by_type(String const& type) const;
  16. WebIDL::ExceptionOr<Vector<JS::Handle<PerformanceTimeline::PerformanceEntry>>> get_entries_by_name(String const& name, Optional<String> type) const;
  17. private:
  18. PerformanceObserverEntryList(JS::Realm&, Vector<JS::NonnullGCPtr<PerformanceTimeline::PerformanceEntry>>&&);
  19. virtual void initialize(JS::Realm&) override;
  20. virtual void visit_edges(Cell::Visitor&) override;
  21. // https://w3c.github.io/performance-timeline/#dfn-entry-list
  22. // Returns a PerformanceEntryList object returned by filter buffer by name and type algorithm with this's entry list,
  23. // name and type set to null.
  24. Vector<JS::NonnullGCPtr<PerformanceTimeline::PerformanceEntry>> m_entry_list;
  25. };
  26. ErrorOr<Vector<JS::Handle<PerformanceTimeline::PerformanceEntry>>> filter_buffer_by_name_and_type(Vector<JS::NonnullGCPtr<PerformanceTimeline::PerformanceEntry>> const& buffer, Optional<String> name, Optional<String> type);
  27. }