Bug 1417519 - Don't allow things to get raw pointers to WebRenderAPI. r=sotaro

It seems like a footgun to expose raw pointers to WebRenderAPI which is
a refcounted object. Let's only expose it via refcounting pointers.

MozReview-Commit-ID: AKmTZg2V99r

--HG--
extra : rebase_source : 805f13d56a64bafbcdf3bf4266eec47c70856564
This commit is contained in:
Kartikaya Gupta 2017-11-17 10:54:24 -05:00
Родитель 9d9fb92aed
Коммит 6946f16436
3 изменённых файлов: 5 добавлений и 3 удалений

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

@ -1659,7 +1659,8 @@ CompositorBridgeParent::RecvAdoptChild(const uint64_t& child)
ScheduleComposition();
}
if (mWrBridge && sIndirectLayerTrees[child].mWrBridge) {
RefPtr<wr::WebRenderAPI> api = mWrBridge->GetWebRenderAPI()->Clone();
RefPtr<wr::WebRenderAPI> api = mWrBridge->GetWebRenderAPI();
api = api->Clone();
sIndirectLayerTrees[child].mWrBridge->UpdateWebRender(mWrBridge->CompositorScheduler(),
api,
mWrBridge->AsyncImageManager(),

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

@ -228,7 +228,8 @@ CrossProcessCompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::Pipeli
return parent;
}
RefPtr<wr::WebRenderAPI> api = root->GetWebRenderAPI()->Clone();
RefPtr<wr::WebRenderAPI> api = root->GetWebRenderAPI();
api = api->Clone();
RefPtr<AsyncImagePipelineManager> holder = root->AsyncImageManager();
RefPtr<CompositorAnimationStorage> animStorage = cbp->GetAnimationStorage();
parent = new WebRenderBridgeParent(this, aPipelineId, nullptr, root->CompositorScheduler(), Move(api), Move(holder), Move(animStorage));

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

@ -58,7 +58,7 @@ public:
static WebRenderBridgeParent* CreateDestroyed(const wr::PipelineId& aPipelineId);
wr::PipelineId PipelineId() { return mPipelineId; }
wr::WebRenderAPI* GetWebRenderAPI() { return mApi; }
already_AddRefed<wr::WebRenderAPI> GetWebRenderAPI() { return do_AddRef(mApi); }
wr::Epoch WrEpoch() { return wr::NewEpoch(mWrEpoch); }
AsyncImagePipelineManager* AsyncImageManager() { return mAsyncImageManager; }
CompositorVsyncScheduler* CompositorScheduler() { return mCompositorScheduler.get(); }