Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/ChromeBrowsingContext.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 ChromeBrowsingContext_h
8
#define ChromeBrowsingContext_h
9
10
#include "mozilla/dom/BrowsingContext.h"
11
#include "mozilla/RefPtr.h"
12
#include "nsCycleCollectionParticipant.h"
13
#include "nsWrapperCache.h"
14
15
class nsIDocShell;
16
17
namespace mozilla {
18
namespace dom {
19
20
// ChromeBrowsingContext is a BrowsingContext living in the parent
21
// process, with whatever extra data that a BrowsingContext in the
22
// parent needs.
23
class ChromeBrowsingContext final
24
  : public BrowsingContext
25
{
26
public:
27
  static void CleanupContexts(uint64_t aProcessId);
28
  static already_AddRefed<ChromeBrowsingContext> Get(uint64_t aId);
29
  static ChromeBrowsingContext* Cast(BrowsingContext* aContext);
30
  static already_AddRefed<ChromeBrowsingContext> Create(
31
    uint64_t aBrowsingContextId,
32
    const nsAString& aName,
33
    uint64_t aProcessId);
34
35
  bool IsOwnedByProcess(uint64_t aProcessId) const
36
0
  {
37
0
    return mProcessId == aProcessId;
38
0
  }
39
40
protected:
41
  void Traverse(nsCycleCollectionTraversalCallback& cb) {}
42
  void Unlink() {}
43
  ChromeBrowsingContext(uint64_t aBrowsingContextId,
44
                        const nsAString& aName,
45
                        uint64_t aProcessId);
46
47
private:
48
  friend class BrowsingContext;
49
50
  explicit ChromeBrowsingContext(nsIDocShell* aDocShell);
51
52
  // Indicates which process owns the docshell.
53
  uint64_t mProcessId;
54
};
55
56
} // namespace dom
57
} // namespace mozilla
58
#endif