Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/apz/util/ContentProcessController.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
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#include "ContentProcessController.h"
8
9
#include "mozilla/dom/TabChild.h"
10
#include "mozilla/layers/APZCCallbackHelper.h"
11
#include "mozilla/layers/APZChild.h"
12
#include "nsIContentInlines.h"
13
14
#include "InputData.h"                  // for InputData
15
16
namespace mozilla {
17
namespace layers {
18
19
ContentProcessController::ContentProcessController(const RefPtr<dom::TabChild>& aBrowser)
20
    : mBrowser(aBrowser)
21
0
{
22
0
  MOZ_ASSERT(mBrowser);
23
0
}
24
25
void
26
ContentProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
27
0
{
28
0
  if (mBrowser) {
29
0
    mBrowser->UpdateFrame(aFrameMetrics);
30
0
  }
31
0
}
32
33
void
34
ContentProcessController::HandleTap(
35
                        TapType aType,
36
                        const LayoutDevicePoint& aPoint,
37
                        Modifiers aModifiers,
38
                        const ScrollableLayerGuid& aGuid,
39
                        uint64_t aInputBlockId)
40
0
{
41
0
  // This should never get called
42
0
  MOZ_ASSERT(false);
43
0
}
44
45
void
46
ContentProcessController::NotifyPinchGesture(
47
                        PinchGestureInput::PinchGestureType aType,
48
                        const ScrollableLayerGuid& aGuid,
49
                        LayoutDeviceCoord aSpanChange,
50
                        Modifiers aModifiers)
51
0
{
52
0
  // This should never get called
53
0
  MOZ_ASSERT_UNREACHABLE("Unexpected message to content process");
54
0
}
55
56
void
57
ContentProcessController::NotifyAPZStateChange(
58
                                  const ScrollableLayerGuid& aGuid,
59
                                  APZStateChange aChange,
60
                                  int aArg)
61
0
{
62
0
  if (mBrowser) {
63
0
    mBrowser->NotifyAPZStateChange(aGuid.mScrollId, aChange, aArg);
64
0
  }
65
0
}
66
67
void
68
ContentProcessController::NotifyMozMouseScrollEvent(
69
                                  const FrameMetrics::ViewID& aScrollId,
70
                                  const nsString& aEvent)
71
0
{
72
0
  if (mBrowser) {
73
0
    APZCCallbackHelper::NotifyMozMouseScrollEvent(aScrollId, aEvent);
74
0
  }
75
0
}
76
77
void
78
ContentProcessController::NotifyFlushComplete()
79
0
{
80
0
  if (mBrowser) {
81
0
    nsCOMPtr<nsIPresShell> shell;
82
0
    if (nsCOMPtr<nsIDocument> doc = mBrowser->GetDocument()) {
83
0
      shell = doc->GetShell();
84
0
    }
85
0
    APZCCallbackHelper::NotifyFlushComplete(shell.get());
86
0
  }
87
0
}
88
89
void
90
ContentProcessController::NotifyAsyncScrollbarDragRejected(const FrameMetrics::ViewID& aScrollId)
91
0
{
92
0
  APZCCallbackHelper::NotifyAsyncScrollbarDragRejected(aScrollId);
93
0
}
94
95
void
96
ContentProcessController::NotifyAsyncAutoscrollRejected(const FrameMetrics::ViewID& aScrollId)
97
0
{
98
0
  APZCCallbackHelper::NotifyAsyncAutoscrollRejected(aScrollId);
99
0
}
100
101
void
102
ContentProcessController::CancelAutoscroll(const ScrollableLayerGuid& aGuid)
103
0
{
104
0
  // This should never get called
105
0
  MOZ_ASSERT_UNREACHABLE("Unexpected message to content process");
106
0
}
107
108
void
109
ContentProcessController::PostDelayedTask(already_AddRefed<Runnable> aRunnable, int aDelayMs)
110
0
{
111
0
  MOZ_ASSERT_UNREACHABLE("ContentProcessController should only be used remotely.");
112
0
}
113
114
bool
115
ContentProcessController::IsRepaintThread()
116
0
{
117
0
  return NS_IsMainThread();
118
0
}
119
120
void
121
ContentProcessController::DispatchToRepaintThread(already_AddRefed<Runnable> aTask)
122
0
{
123
0
  NS_DispatchToMainThread(std::move(aTask));
124
0
}
125
126
} // namespace layers
127
} // namespace mozilla