Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/base/PlacesWeakCallbackWrapper.cpp
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 file,
5
 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#include "mozilla/dom/PlacesWeakCallbackWrapper.h"
8
9
#include "mozilla/HoldDropJSObjects.h"
10
#include "mozilla/dom/ContentProcessMessageManager.h"
11
12
namespace mozilla {
13
namespace dom {
14
15
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PlacesWeakCallbackWrapper, mParent, mCallback)
16
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(PlacesWeakCallbackWrapper, AddRef)
17
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(PlacesWeakCallbackWrapper, Release)
18
19
PlacesWeakCallbackWrapper::PlacesWeakCallbackWrapper(nsISupports* aParent,
20
                                                     PlacesEventCallback& aCallback)
21
  : mParent(do_GetWeakReference(aParent))
22
  , mCallback(&aCallback)
23
0
{
24
0
}
25
26
already_AddRefed<PlacesWeakCallbackWrapper>
27
PlacesWeakCallbackWrapper::Constructor(const GlobalObject& aGlobal,
28
                                       PlacesEventCallback& aCallback,
29
                                       ErrorResult& rv)
30
0
{
31
0
  nsCOMPtr<nsISupports> parent = aGlobal.GetAsSupports();
32
0
  RefPtr<PlacesWeakCallbackWrapper> wrapper =
33
0
    new PlacesWeakCallbackWrapper(parent, aCallback);
34
0
  return wrapper.forget();
35
0
}
36
37
PlacesWeakCallbackWrapper::~PlacesWeakCallbackWrapper()
38
0
{
39
0
}
40
41
nsISupports*
42
PlacesWeakCallbackWrapper::GetParentObject() const
43
0
{
44
0
  nsCOMPtr<nsISupports> parent = do_QueryReferent(mParent);
45
0
  return parent;
46
0
}
47
48
JSObject*
49
PlacesWeakCallbackWrapper::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
50
0
{
51
0
  return PlacesWeakCallbackWrapper_Binding::Wrap(aCx, this, aGivenProto);
52
0
}
53
54
} // namespace dom
55
} // namespace mozilla