Create a common chrome-process GeckoContentController. (
bug 1110540 part 2, r=kats)
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/util/ChromeProcessController.cpp
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/layers/ChromeProcessController.h"
+#include "mozilla/layers/CompositorParent.h"
+#include "mozilla/layers/APZCCallbackHelper.h"
+#include "nsLayoutUtils.h"
+
+using namespace mozilla;
+using namespace mozilla::layers;
+using namespace mozilla::widget;
+
+void
+ChromeProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
+{
+ MOZ_ASSERT(NS_IsMainThread());
+
+ nsCOMPtr<nsIContent> targetContent = nsLayoutUtils::FindContentFor(aFrameMetrics.GetScrollId());
+ if (targetContent) {
+ FrameMetrics metrics = aFrameMetrics;
+ APZCCallbackHelper::UpdateSubFrame(targetContent, metrics);
+ }
+}
+
+void
+ChromeProcessController::PostDelayedTask(Task* aTask, int aDelayMs)
+{
+ MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
+}
+
+void
+ChromeProcessController::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
+ const uint32_t& aScrollGeneration)
+{
+ APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
+}
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/util/ChromeProcessController.h
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_layers_ChromeProcessController_h
+#define mozilla_layers_ChromeProcessController_h
+
+#include "mozilla/layers/GeckoContentController.h"
+
+namespace mozilla {
+
+namespace layers {
+class CompositorParent;
+
+// A ChromeProcessController is attached to the root of a compositor's layer
+// tree.
+class ChromeProcessController : public mozilla::layers::GeckoContentController
+{
+ typedef mozilla::layers::FrameMetrics FrameMetrics;
+ typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
+
+public:
+ // GeckoContentController interface
+ virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) MOZ_OVERRIDE;
+ virtual void PostDelayedTask(Task* aTask, int aDelayMs) MOZ_OVERRIDE;
+ virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
+ const uint32_t& aScrollGeneration) MOZ_OVERRIDE;
+
+ virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
+ const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
+ virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
+ const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
+ virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
+ const ScrollableLayerGuid& aGuid,
+ uint64_t aInputBlockId) MOZ_OVERRIDE {}
+ virtual void HandleLongTapUp(const CSSPoint& aPoint, int32_t aModifiers,
+ const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
+ virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect,
+ const mozilla::CSSSize &aScrollableSize) MOZ_OVERRIDE {}
+};
+
+} // namespace layers
+} // namespace mozilla
+
+#endif /* mozilla_layers_ChromeProcessController_h */
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -108,16 +108,17 @@ EXPORTS.gfxipc += [
EXPORTS.mozilla.layers += [
'apz/public/GeckoContentController.h',
# exporting things from apz/src is temporary until we extract a
# proper interface for the code there
'apz/src/APZCTreeManager.h',
'apz/testutil/APZTestData.h',
'apz/util/ActiveElementManager.h',
'apz/util/APZCCallbackHelper.h',
+ 'apz/util/ChromeProcessController.h',
'AtomicRefCountedWithFinalize.h',
'AxisPhysicsModel.h',
'AxisPhysicsMSDModel.h',
'basic/BasicCompositor.h',
'basic/MacIOSurfaceTextureHostBasic.h',
'basic/TextureHostBasic.h',
'client/CanvasClient.h',
'client/CompositableClient.h',
@@ -239,16 +240,17 @@ UNIFIED_SOURCES += [
'apz/src/GestureEventListener.cpp',
'apz/src/InputBlockState.cpp',
'apz/src/InputQueue.cpp',
'apz/src/OverscrollHandoffState.cpp',
'apz/src/TaskThrottler.cpp',
'apz/testutil/APZTestData.cpp',
'apz/util/ActiveElementManager.cpp',
'apz/util/APZCCallbackHelper.cpp',
+ 'apz/util/ChromeProcessController.cpp',
'AxisPhysicsModel.cpp',
'AxisPhysicsMSDModel.cpp',
'basic/BasicCanvasLayer.cpp',
'basic/BasicColorLayer.cpp',
'basic/BasicCompositor.cpp',
'basic/BasicContainerLayer.cpp',
'basic/BasicImages.cpp',
'basic/BasicLayerManager.cpp',
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -544,17 +544,16 @@ protected:
AllocateChildPopupWidget()
{
static NS_DEFINE_IID(kCPopUpCID, NS_POPUP_CID);
nsCOMPtr<nsIWidget> widget = do_CreateInstance(kCPopUpCID);
return widget.forget();
}
void ConfigureAPZCTreeManager() MOZ_OVERRIDE;
- already_AddRefed<GeckoContentController> CreateRootContentController() MOZ_OVERRIDE;
void DoRemoteComposition(const nsIntRect& aRenderRect);
// Overlay drawing functions for OpenGL drawing
void DrawWindowOverlay(mozilla::layers::GLManager* aManager, nsIntRect aRect);
void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -79,17 +79,17 @@
#include <dlfcn.h>
#include <ApplicationServices/ApplicationServices.h>
#include "GeckoProfiler.h"
#include "nsIDOMWheelEvent.h"
-#include "mozilla/layers/APZCCallbackHelper.h"
+#include "mozilla/layers/ChromeProcessController.h"
#include "nsLayoutUtils.h"
#include "InputData.h"
#include "VibrancyManager.h"
using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::gl;
using namespace mozilla::widget;
@@ -388,58 +388,16 @@ public:
protected:
nsRefPtr<mozilla::gl::GLContext> mGLContext;
nsAutoPtr<mozilla::layers::ShaderProgramOGL> mRGBARectProgram;
gfx::Matrix4x4 mProjMatrix;
GLuint mQuadVBO;
};
-class APZCTMController : public mozilla::layers::GeckoContentController
-{
- typedef mozilla::layers::FrameMetrics FrameMetrics;
- typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
-
-public:
- // GeckoContentController interface
- virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics)
- {
- MOZ_ASSERT(NS_IsMainThread());
-
- nsCOMPtr<nsIContent> targetContent = nsLayoutUtils::FindContentFor(aFrameMetrics.GetScrollId());
- if (targetContent) {
- FrameMetrics metrics = aFrameMetrics;
- APZCCallbackHelper::UpdateSubFrame(targetContent, metrics);
- }
- }
-
- virtual void PostDelayedTask(Task* aTask, int aDelayMs) MOZ_OVERRIDE
- {
- MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
- }
-
- virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
- const uint32_t& aScrollGeneration) MOZ_OVERRIDE
- {
- APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
- }
-
- virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
- const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
- virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
- const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
- virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
- const ScrollableLayerGuid& aGuid,
- uint64_t aInputBlockId) MOZ_OVERRIDE {}
- virtual void HandleLongTapUp(const CSSPoint& aPoint, int32_t aModifiers,
- const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
- virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect,
- const mozilla::CSSSize &aScrollableSize) MOZ_OVERRIDE {}
-};
-
} // unnamed namespace
#pragma mark -
nsChildView::nsChildView() : nsBaseWidget()
, mView(nullptr)
, mParentView(nullptr)
, mParentWidget(nullptr)
@@ -1879,23 +1837,16 @@ void
nsChildView::CreateCompositor()
{
nsBaseWidget::CreateCompositor();
if (mCompositorChild) {
[(ChildView *)mView setUsingOMTCompositor:true];
}
}
-already_AddRefed<GeckoContentController>
-nsChildView::CreateRootContentController()
-{
- nsRefPtr<APZCTMController> controller = new APZCTMController();
- return controller.forget();
-}
-
void
nsChildView::ConfigureAPZCTreeManager()
{
nsBaseWidget::ConfigureAPZCTreeManager();
if (gNumberOfWidgetsNeedingEventThread == 0) {
[EventThreadRunner start];
}
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -39,16 +39,17 @@
#include "mozilla/unused.h"
#include "nsContentUtils.h"
#include "gfxPrefs.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/MouseEvents.h"
#include "GLConsts.h"
#include "mozilla/unused.h"
#include "mozilla/layers/APZCTreeManager.h"
+#include "mozilla/layers/ChromeProcessController.h"
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
#endif
#ifdef DEBUG
#include "nsIObserver.h"
@@ -910,17 +911,18 @@ void nsBaseWidget::CreateCompositor()
nsIntRect rect;
GetBounds(rect);
CreateCompositor(rect.width, rect.height);
}
already_AddRefed<GeckoContentController>
nsBaseWidget::CreateRootContentController()
{
- return nullptr;
+ nsRefPtr<GeckoContentController> controller = new ChromeProcessController();
+ return controller.forget();
}
void nsBaseWidget::ConfigureAPZCTreeManager()
{
uint64_t rootLayerTreeId = mCompositorParent->RootLayerTreeId();
mAPZC = CompositorParent::GetAPZCTreeManager(rootLayerTreeId);
MOZ_ASSERT(mAPZC);