Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/storage/mozStorageAsyncStatementJSHelper.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
 * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
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_storage_mozStorageAsyncStatementJSHelper_h_
8
#define mozilla_storage_mozStorageAsyncStatementJSHelper_h_
9
10
#include "nsIXPCScriptable.h"
11
#include "nsIXPConnect.h"
12
13
namespace mozilla {
14
namespace storage {
15
16
class AsyncStatement;
17
class AsyncStatementParams;
18
19
/**
20
 * A modified version of StatementJSHelper that only exposes the async-specific
21
 * 'params' helper.  We do not expose 'row' or 'step' as they do not apply to
22
 * us.
23
 */
24
class AsyncStatementJSHelper : public nsIXPCScriptable
25
{
26
public:
27
  NS_DECL_ISUPPORTS
28
  NS_DECL_NSIXPCSCRIPTABLE
29
30
private:
31
  nsresult getParams(AsyncStatement *, JSContext *, JSObject *, JS::Value *);
32
};
33
34
/**
35
 * Wrapper used to clean up the references JS helpers hold to the statement.
36
 * For cycle-avoidance reasons they do not hold reference-counted references,
37
 * so it is important we do this.
38
 */
39
class AsyncStatementParamsHolder final : public nsISupports {
40
public:
41
  NS_DECL_ISUPPORTS
42
43
  explicit AsyncStatementParamsHolder(AsyncStatementParams* aParams)
44
    : mParams(aParams)
45
0
  {
46
0
  }
47
48
0
  AsyncStatementParams* Get() const {
49
0
    MOZ_ASSERT(mParams);
50
0
    return mParams;
51
0
  }
52
53
private:
54
  virtual ~AsyncStatementParamsHolder();
55
56
  RefPtr<AsyncStatementParams> mParams;
57
};
58
59
} // namespace storage
60
} // namespace mozilla
61
62
#endif // mozilla_storage_mozStorageAsyncStatementJSHelper_h_