Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/simpledb/SDBConnection.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 file,
5
 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_dom_simpledb_SDBConnection_h
8
#define mozilla_dom_simpledb_SDBConnection_h
9
10
#include "nsAutoPtr.h"
11
#include "nsISDBConnection.h"
12
#include "nsTArray.h"
13
14
#define NS_SDBCONNECTION_CONTRACTID \
15
  "@mozilla.org/dom/sdb-connection;1"
16
17
class nsISDBCloseCallback;
18
19
namespace mozilla {
20
21
namespace ipc {
22
23
class PBackgroundChild;
24
class PrincipalInfo;
25
26
} // namespace ipc
27
28
namespace dom {
29
30
class SDBConnectionChild;
31
class SDBRequest;
32
class SDBRequestParams;
33
34
class SDBConnection final
35
  : public nsISDBConnection
36
{
37
  typedef mozilla::ipc::PBackgroundChild PBackgroundChild;
38
  typedef mozilla::ipc::PrincipalInfo PrincipalInfo;
39
40
  nsCOMPtr<nsISDBCloseCallback> mCloseCallback;
41
42
  nsAutoPtr<PrincipalInfo> mPrincipalInfo;
43
44
  SDBConnectionChild* mBackgroundActor;
45
46
  bool mRunningRequest;
47
  bool mOpen;
48
  bool mAllowedToClose;
49
50
public:
51
  static nsresult
52
  Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
53
54
  void
55
  AssertIsOnOwningThread() const
56
0
  {
57
0
    NS_ASSERT_OWNINGTHREAD(SDBConnection);
58
0
  }
59
60
  void
61
  ClearBackgroundActor();
62
63
  void
64
  OnNewRequest();
65
66
  void
67
  OnRequestFinished();
68
69
  void
70
  OnOpen();
71
72
  void
73
  OnClose(bool aAbnormal);
74
75
  void
76
  AllowToClose();
77
78
private:
79
  SDBConnection();
80
81
  ~SDBConnection();
82
83
  nsresult
84
  CheckState();
85
86
  nsresult
87
  EnsureBackgroundActor();
88
89
  nsresult
90
  InitiateRequest(SDBRequest* aRequest,
91
                  const SDBRequestParams& aParams);
92
93
  NS_DECL_ISUPPORTS
94
  NS_DECL_NSISDBCONNECTION
95
};
96
97
} // namespace dom
98
} // namespace mozilla
99
100
#endif /* mozilla_dom_simpledb_SDBConnection_h */