Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set sw=4 ts=8 et 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 1 : ContentProcessController::ContentProcessController(const RefPtr<dom::TabChild>& aBrowser)
20 1 : : mBrowser(aBrowser)
21 : {
22 1 : MOZ_ASSERT(mBrowser);
23 1 : }
24 :
25 : void
26 0 : ContentProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
27 : {
28 0 : if (mBrowser) {
29 0 : mBrowser->UpdateFrame(aFrameMetrics);
30 : }
31 0 : }
32 :
33 : void
34 0 : ContentProcessController::HandleTap(
35 : TapType aType,
36 : const LayoutDevicePoint& aPoint,
37 : Modifiers aModifiers,
38 : const ScrollableLayerGuid& aGuid,
39 : uint64_t aInputBlockId)
40 : {
41 : // This should never get called
42 0 : MOZ_ASSERT(false);
43 : }
44 :
45 : void
46 0 : ContentProcessController::NotifyPinchGesture(
47 : PinchGestureInput::PinchGestureType aType,
48 : const ScrollableLayerGuid& aGuid,
49 : LayoutDeviceCoord aSpanChange,
50 : Modifiers aModifiers)
51 : {
52 : // This should never get called
53 0 : MOZ_ASSERT_UNREACHABLE("Unexpected message to content process");
54 : }
55 :
56 : void
57 0 : ContentProcessController::NotifyAPZStateChange(
58 : const ScrollableLayerGuid& aGuid,
59 : APZStateChange aChange,
60 : int aArg)
61 : {
62 0 : if (mBrowser) {
63 0 : mBrowser->NotifyAPZStateChange(aGuid.mScrollId, aChange, aArg);
64 : }
65 0 : }
66 :
67 : void
68 0 : ContentProcessController::NotifyMozMouseScrollEvent(
69 : const FrameMetrics::ViewID& aScrollId,
70 : const nsString& aEvent)
71 : {
72 0 : if (mBrowser) {
73 0 : APZCCallbackHelper::NotifyMozMouseScrollEvent(aScrollId, aEvent);
74 : }
75 0 : }
76 :
77 : void
78 0 : ContentProcessController::NotifyFlushComplete()
79 : {
80 0 : if (mBrowser) {
81 0 : nsCOMPtr<nsIPresShell> shell;
82 0 : if (nsCOMPtr<nsIDocument> doc = mBrowser->GetDocument()) {
83 0 : shell = doc->GetShell();
84 : }
85 0 : APZCCallbackHelper::NotifyFlushComplete(shell.get());
86 : }
87 0 : }
88 :
89 : void
90 0 : ContentProcessController::NotifyAsyncScrollbarDragRejected(const FrameMetrics::ViewID& aScrollId)
91 : {
92 0 : APZCCallbackHelper::NotifyAsyncScrollbarDragRejected(aScrollId);
93 0 : }
94 :
95 : void
96 0 : ContentProcessController::PostDelayedTask(already_AddRefed<Runnable> aRunnable, int aDelayMs)
97 : {
98 0 : MOZ_ASSERT_UNREACHABLE("ContentProcessController should only be used remotely.");
99 : }
100 :
101 : bool
102 0 : ContentProcessController::IsRepaintThread()
103 : {
104 0 : return NS_IsMainThread();
105 : }
106 :
107 : void
108 0 : ContentProcessController::DispatchToRepaintThread(already_AddRefed<Runnable> aTask)
109 : {
110 0 : NS_DispatchToMainThread(Move(aTask));
111 0 : }
112 :
113 : } // namespace layers
114 : } // namespace mozilla
|