Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/MessageBroadcaster.h
Line
Count
Source (jump to first uncovered line)
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 mozilla_dom_MessageBroadcaster_h
8
#define mozilla_dom_MessageBroadcaster_h
9
10
#include "mozilla/dom/MessageListenerManager.h"
11
12
namespace mozilla {
13
namespace dom {
14
15
/**
16
 * Implementation for the WebIDL MessageBroadcaster interface. Base class for window and
17
 * process broadcaster message managers.
18
 */
19
class MessageBroadcaster : public MessageListenerManager
20
{
21
public:
22
  static MessageBroadcaster* From(MessageListenerManager* aManager)
23
0
  {
24
0
    if (aManager->IsBroadcaster()) {
25
0
      return static_cast<MessageBroadcaster*>(aManager);
26
0
    }
27
0
    return nullptr;
28
0
  }
29
30
  void BroadcastAsyncMessage(JSContext* aCx, const nsAString& aMessageName,
31
                             JS::Handle<JS::Value> aObj,
32
                             JS::Handle<JSObject*> aObjects,
33
                             mozilla::ErrorResult& aError)
34
0
  {
35
0
    DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects, nullptr,
36
0
                         JS::UndefinedHandleValue, aError);
37
0
  }
38
  uint32_t ChildCount()
39
0
  {
40
0
    return mChildManagers.Length();
41
0
  }
42
  MessageListenerManager* GetChildAt(uint32_t aIndex)
43
0
  {
44
0
    return mChildManagers.SafeElementAt(aIndex);
45
0
  }
46
  void ReleaseCachedProcesses();
47
48
  void AddChildManager(MessageListenerManager* aManager);
49
  void RemoveChildManager(MessageListenerManager* aManager);
50
51
protected:
52
  MessageBroadcaster(MessageBroadcaster* aParentManager, MessageManagerFlags aFlags);
53
};
54
55
} // namespace dom
56
} // namespace mozilla
57
58
#endif // mozilla_dom_MessageBroadcaster_h