Bug 1343758 - Label the tasks in vr module. r?bevistseng, kip
--- a/gfx/vr/VRDisplayPresentation.cpp
+++ b/gfx/vr/VRDisplayPresentation.cpp
@@ -1,15 +1,16 @@
/* -*- Mode: C++; tab-width: 20; 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 "VRDisplayPresentation.h"
+#include "mozilla/dom/DocGroup.h"
#include "mozilla/Unused.h"
#include "VRDisplayClient.h"
#include "VRLayerChild.h"
using namespace mozilla;
using namespace mozilla::gfx;
VRDisplayPresentation::VRDisplayPresentation(VRDisplayClient *aDisplayClient,
@@ -65,17 +66,26 @@ VRDisplayPresentation::CreateLayers()
}
VRManagerChild *manager = VRManagerChild::Get();
if (!manager) {
NS_WARNING("VRManagerChild::Get returned null!");
continue;
}
- RefPtr<VRLayerChild> vrLayer = static_cast<VRLayerChild*>(manager->CreateVRLayer(mDisplayClient->GetDisplayInfo().GetDisplayID(), leftBounds, rightBounds));
+ nsCOMPtr<nsIEventTarget> target;
+ nsIDocument* doc;
+ doc = canvasElement->OwnerDoc();
+ if (doc) {
+ target = doc->EventTargetFor(TaskCategory::Other);
+ }
+
+ RefPtr<VRLayerChild> vrLayer =
+ static_cast<VRLayerChild*>(manager->CreateVRLayer(mDisplayClient->GetDisplayInfo().GetDisplayID(),
+ leftBounds, rightBounds, target));
if (!vrLayer) {
NS_WARNING("CreateVRLayer returned null!");
continue;
}
vrLayer->Initialize(canvasElement);
mLayers.AppendElement(vrLayer);
--- a/gfx/vr/ipc/VRManagerChild.cpp
+++ b/gfx/vr/ipc/VRManagerChild.cpp
@@ -396,21 +396,36 @@ VRManagerChild::AllocUnsafeShmem(size_t
bool
VRManagerChild::DeallocShmem(ipc::Shmem& aShmem)
{
return PVRManagerChild::DeallocShmem(aShmem);
}
PVRLayerChild*
-VRManagerChild::CreateVRLayer(uint32_t aDisplayID, const Rect& aLeftEyeRect, const Rect& aRightEyeRect)
+VRManagerChild::CreateVRLayer(uint32_t aDisplayID,
+ const Rect& aLeftEyeRect,
+ const Rect& aRightEyeRect,
+ nsIEventTarget* aTarget)
{
- return SendPVRLayerConstructor(aDisplayID,
- aLeftEyeRect.x, aLeftEyeRect.y, aLeftEyeRect.width, aLeftEyeRect.height,
- aRightEyeRect.x, aRightEyeRect.y, aRightEyeRect.width, aRightEyeRect.height);
+ PVRLayerChild* vrLayerChild = AllocPVRLayerChild(aDisplayID, aLeftEyeRect.x,
+ aLeftEyeRect.y, aLeftEyeRect.width,
+ aLeftEyeRect.height, aRightEyeRect.x,
+ aRightEyeRect.y, aRightEyeRect.width,
+ aRightEyeRect.height);
+ // Do the DOM labeling.
+ if (aTarget) {
+ SetEventTargetForActor(vrLayerChild, aTarget);
+ MOZ_ASSERT(vrLayerChild->GetActorEventTarget());
+ }
+ return SendPVRLayerConstructor(vrLayerChild, aDisplayID, aLeftEyeRect.x,
+ aLeftEyeRect.y, aLeftEyeRect.width,
+ aLeftEyeRect.height, aRightEyeRect.x,
+ aRightEyeRect.y, aRightEyeRect.width,
+ aRightEyeRect.height);
}
// XXX TODO - VRManagerChild::FrameRequest is the same as nsIDocument::FrameRequest, should we consolodate these?
struct VRManagerChild::FrameRequest
{
FrameRequest(mozilla::dom::FrameRequestCallback& aCallback,
int32_t aHandle) :
--- a/gfx/vr/ipc/VRManagerChild.h
+++ b/gfx/vr/ipc/VRManagerChild.h
@@ -62,17 +62,20 @@ public:
static bool IsCreated();
virtual PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData,
layers::LayersBackend aLayersBackend,
TextureFlags aFlags,
uint64_t aSerial) override;
virtual void CancelWaitForRecycle(uint64_t aTextureId) override;
- PVRLayerChild* CreateVRLayer(uint32_t aDisplayID, const Rect& aLeftEyeRect, const Rect& aRightEyeRect);
+ PVRLayerChild* CreateVRLayer(uint32_t aDisplayID,
+ const Rect& aLeftEyeRect,
+ const Rect& aRightEyeRect,
+ nsIEventTarget* aTarget);
static void IdentifyTextureHost(const layers::TextureFactoryIdentifier& aIdentifier);
layers::LayersBackend GetBackendType() const;
layers::SyncObject* GetSyncObject() { return mSyncObject; }
virtual MessageLoop* GetMessageLoop() const override { return mMessageLoop; }
virtual base::ProcessId GetParentPid() const override { return OtherPid(); }