tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SharedMapChangeEvent.h (1445B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef dom_ipc_SharedMapChangeEvent_h
      8 #define dom_ipc_SharedMapChangeEvent_h
      9 
     10 #include "mozilla/dom/Event.h"
     11 #include "mozilla/dom/MozSharedMapBinding.h"
     12 #include "nsTArray.h"
     13 
     14 namespace mozilla::dom::ipc {
     15 
     16 class SharedMapChangeEvent final : public Event {
     17 public:
     18  NS_INLINE_DECL_REFCOUNTING_INHERITED(SharedMapChangeEvent, Event)
     19 
     20  JSObject* WrapObjectInternal(JSContext* aCx,
     21                               JS::Handle<JSObject*> aGivenProto) override {
     22    return MozSharedMapChangeEvent_Binding::Wrap(aCx, this, aGivenProto);
     23  }
     24 
     25  static already_AddRefed<SharedMapChangeEvent> Constructor(
     26      EventTarget* aEventTarget, const nsAString& aType,
     27      const MozSharedMapChangeEventInit& aInit);
     28 
     29  void GetChangedKeys(nsTArray<nsString>& aChangedKeys) const {
     30    aChangedKeys.AppendElements(mChangedKeys);
     31  }
     32 
     33 protected:
     34  ~SharedMapChangeEvent() override = default;
     35 
     36 private:
     37  explicit SharedMapChangeEvent(EventTarget* aEventTarget)
     38      : Event(aEventTarget, nullptr, nullptr) {}
     39 
     40  nsTArray<nsString> mChangedKeys;
     41 };
     42 
     43 }  // namespace mozilla::dom::ipc
     44 
     45 #endif  // dom_ipc_SharedMapChangeEvent_h