mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-24 00:24:14 +00:00
Bug 1405364 - ImageBridgeParent::GetInstance should not mutate sImageBridges for lookups. r=sotaro
This commit is contained in:
parent
f3cd43457f
commit
63fdae83e1
@ -42,7 +42,7 @@ using namespace mozilla::ipc;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::media;
|
||||
|
||||
std::map<base::ProcessId, ImageBridgeParent*> ImageBridgeParent::sImageBridges;
|
||||
ImageBridgeParent::ImageBridgeMap ImageBridgeParent::sImageBridges;
|
||||
|
||||
StaticAutoPtr<mozilla::Monitor> sImageBridgesLock;
|
||||
|
||||
@ -369,8 +369,9 @@ ImageBridgeParent::NotifyImageComposites(nsTArray<ImageCompositeNotificationInfo
|
||||
notifications.AppendElement(aNotifications[end].mNotification);
|
||||
++end;
|
||||
}
|
||||
GetInstance(pid)->SendPendingAsyncMessages();
|
||||
if (!GetInstance(pid)->SendDidComposite(notifications)) {
|
||||
RefPtr<ImageBridgeParent> bridge = GetInstance(pid);
|
||||
bridge->SendPendingAsyncMessages();
|
||||
if (!bridge->SendDidComposite(notifications)) {
|
||||
ok = false;
|
||||
}
|
||||
i = end;
|
||||
@ -385,13 +386,18 @@ ImageBridgeParent::DeferredDestroy()
|
||||
mSelfRef = nullptr; // "this" ImageBridge may get deleted here.
|
||||
}
|
||||
|
||||
RefPtr<ImageBridgeParent>
|
||||
already_AddRefed<ImageBridgeParent>
|
||||
ImageBridgeParent::GetInstance(ProcessId aId)
|
||||
{
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
MonitorAutoLock lock(*sImageBridgesLock);
|
||||
NS_ASSERTION(sImageBridges.count(aId) == 1, "ImageBridgeParent for the process");
|
||||
return sImageBridges[aId];
|
||||
ImageBridgeMap::const_iterator i = sImageBridges.find(aId);
|
||||
if (i == sImageBridges.end()) {
|
||||
NS_ASSERTION(false, "Cannot find image bridge for process!");
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<ImageBridgeParent> bridge = i->second;
|
||||
return bridge.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
|
||||
virtual bool IsSameProcess() const override;
|
||||
|
||||
static RefPtr<ImageBridgeParent> GetInstance(ProcessId aId);
|
||||
static already_AddRefed<ImageBridgeParent> GetInstance(ProcessId aId);
|
||||
|
||||
static bool NotifyImageComposites(nsTArray<ImageCompositeNotificationInfo>& aNotifications);
|
||||
|
||||
@ -140,7 +140,8 @@ private:
|
||||
/**
|
||||
* Map of all living ImageBridgeParent instances
|
||||
*/
|
||||
static std::map<base::ProcessId, ImageBridgeParent*> sImageBridges;
|
||||
typedef std::map<base::ProcessId, ImageBridgeParent*> ImageBridgeMap;
|
||||
static ImageBridgeMap sImageBridges;
|
||||
|
||||
RefPtr<CompositorThreadHolderDebug> mCompositorThreadHolder;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user