Bug 1333968 - Label the DidComposite message (r=dvander)

MozReview-Commit-ID: 7cW7apxUJu0
This commit is contained in:
Bill McCloskey 2017-04-10 13:42:36 -07:00
Родитель 5203251704
Коммит 30b9639c6e
4 изменённых файлов: 43 добавлений и 1 удалений

Просмотреть файл

@ -163,6 +163,7 @@ static const char BEFORE_FIRST_PAINT[] = "before-first-paint";
typedef nsDataHashtable<nsUint64HashKey, TabChild*> TabChildMap; typedef nsDataHashtable<nsUint64HashKey, TabChild*> TabChildMap;
static TabChildMap* sTabChildren; static TabChildMap* sTabChildren;
StaticMutex sTabChildrenMutex;
TabChildBase::TabChildBase() TabChildBase::TabChildBase()
: mTabChildGlobal(nullptr) : mTabChildGlobal(nullptr)
@ -1089,6 +1090,8 @@ TabChild::DestroyWindow()
if (mLayersId != 0) { if (mLayersId != 0) {
StaticMutexAutoLock lock(sTabChildrenMutex);
MOZ_ASSERT(sTabChildren); MOZ_ASSERT(sTabChildren);
sTabChildren->Remove(mLayersId); sTabChildren->Remove(mLayersId);
if (!sTabChildren->Count()) { if (!sTabChildren->Count()) {
@ -2654,6 +2657,9 @@ TabChild::InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIden
return; return;
} }
// Cache the TabGroup so it can be fetched off the main thread.
TabGroup();
MOZ_ASSERT(aLayersId != 0); MOZ_ASSERT(aLayersId != 0);
mTextureFactoryIdentifier = aTextureFactoryIdentifier; mTextureFactoryIdentifier = aTextureFactoryIdentifier;
@ -2669,6 +2675,8 @@ TabChild::InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIden
mRemoteFrame = static_cast<RenderFrameChild*>(aRenderFrame); mRemoteFrame = static_cast<RenderFrameChild*>(aRenderFrame);
if (aLayersId != 0) { if (aLayersId != 0) {
StaticMutexAutoLock lock(sTabChildrenMutex);
if (!sTabChildren) { if (!sTabChildren) {
sTabChildren = new TabChildMap; sTabChildren = new TabChildMap;
} }
@ -2958,6 +2966,8 @@ TabChild::DoSendAsyncMessage(JSContext* aCx,
/* static */ nsTArray<RefPtr<TabChild>> /* static */ nsTArray<RefPtr<TabChild>>
TabChild::GetAll() TabChild::GetAll()
{ {
StaticMutexAutoLock lock(sTabChildrenMutex);
nsTArray<RefPtr<TabChild>> list; nsTArray<RefPtr<TabChild>> list;
if (!sTabChildren) { if (!sTabChildren) {
return list; return list;
@ -2984,6 +2994,7 @@ TabChild::GetFrom(nsIPresShell* aPresShell)
TabChild* TabChild*
TabChild::GetFrom(uint64_t aLayersId) TabChild::GetFrom(uint64_t aLayersId)
{ {
StaticMutexAutoLock lock(sTabChildrenMutex);
if (!sTabChildren) { if (!sTabChildren) {
return nullptr; return nullptr;
} }
@ -3333,9 +3344,15 @@ TabChildSHistoryListener::SHistoryDidUpdate(bool aTruncate /* = false */)
mozilla::dom::TabGroup* mozilla::dom::TabGroup*
TabChild::TabGroup() TabChild::TabGroup()
{ {
if (mTabGroup) {
return mTabGroup;
}
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation()); nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
MOZ_ASSERT(window); MOZ_ASSERT(window);
return window->TabGroup(); mTabGroup = window->TabGroup();
return mTabGroup;
} }
/******************************************************************************* /*******************************************************************************

Просмотреть файл

@ -769,6 +769,7 @@ private:
TextureFactoryIdentifier mTextureFactoryIdentifier; TextureFactoryIdentifier mTextureFactoryIdentifier;
nsCOMPtr<nsIWebNavigation> mWebNav; nsCOMPtr<nsIWebNavigation> mWebNav;
RefPtr<mozilla::dom::TabGroup> mTabGroup;
RefPtr<PuppetWidget> mPuppetWidget; RefPtr<PuppetWidget> mPuppetWidget;
nsCOMPtr<nsIURI> mLastURI; nsCOMPtr<nsIURI> mLastURI;
RenderFrameChild* mRemoteFrame; RenderFrameChild* mRemoteFrame;

Просмотреть файл

@ -927,6 +927,27 @@ CompositorBridgeChild::RecvObserveLayerUpdate(const uint64_t& aLayersId,
return IPC_OK(); return IPC_OK();
} }
already_AddRefed<nsIEventTarget>
CompositorBridgeChild::GetSpecificMessageEventTarget(const Message& aMsg)
{
if (aMsg.type() != PCompositorBridge::Msg_DidComposite__ID) {
return nullptr;
}
uint64_t layersId;
PickleIterator iter(aMsg);
if (!IPC::ReadParam(&aMsg, &iter, &layersId)) {
return nullptr;
}
TabChild* tabChild = TabChild::GetFrom(layersId);
if (!tabChild) {
return nullptr;
}
return do_AddRef(tabChild->TabGroup()->EventTargetFor(TaskCategory::Other));
}
void void
CompositorBridgeChild::HoldUntilCompositableRefReleasedIfNecessary(TextureClient* aClient) CompositorBridgeChild::HoldUntilCompositableRefReleasedIfNecessary(TextureClient* aClient)
{ {

Просмотреть файл

@ -265,6 +265,9 @@ private:
const uint64_t& aEpoch, const uint64_t& aEpoch,
const bool& aActive) override; const bool& aActive) override;
already_AddRefed<nsIEventTarget>
GetSpecificMessageEventTarget(const Message& aMsg) override;
// Class used to store the shared FrameMetrics, mutex, and APZCId in a hash table // Class used to store the shared FrameMetrics, mutex, and APZCId in a hash table
class SharedFrameMetricsData { class SharedFrameMetricsData {
public: public: