Chromium Code Reviews| Index: ppapi/proxy/compositor_resource.cc |
| diff --git a/ppapi/proxy/compositor_resource.cc b/ppapi/proxy/compositor_resource.cc |
| index 3ada734849839aca56078ac7e3859b6d574df1a6..67260400c9728a96186d6dc86bf64fc838ce31c7 100644 |
| --- a/ppapi/proxy/compositor_resource.cc |
| +++ b/ppapi/proxy/compositor_resource.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/logging.h" |
| #include "ppapi/proxy/ppapi_messages.h" |
| +#include "ppapi/thunk/enter.h" |
| namespace ppapi { |
| namespace proxy { |
| @@ -18,6 +19,16 @@ CompositorResource::CompositorResource(Connection connection, |
| SendCreate(RENDERER, PpapiHostMsg_Compositor_Create()); |
| } |
| +bool CompositorResource::IsInProgress() const { |
| + ProxyLock::AssertAcquiredDebugOnly(); |
| + return TrackedCallback::IsPending(commit_callback_); |
| +} |
| + |
| +int32_t CompositorResource::GenerateResourceId() const { |
| + ProxyLock::AssertAcquiredDebugOnly(); |
| + return ++last_resource_id_; |
| +} |
| + |
| CompositorResource::~CompositorResource() { |
| ResetLayersInternal(); |
| } |
| @@ -74,10 +85,24 @@ int32_t CompositorResource::CommitLayers( |
| int32_t CompositorResource::ResetLayers() { |
| if (IsInProgress()) |
| return PP_ERROR_INPROGRESS; |
| + |
| ResetLayersInternal(); |
| return PP_OK; |
| } |
| +void CompositorResource::NotifyLastPluginRefWasDeleted() { |
| + PluginResource::NotifyLastPluginRefWasDeleted(); |
| + ResetLayersInternal(); |
| + // The resource dtor sends an IPC message to renderer, and then the renderer |
| + // will delete the resource host. |
| + // But in this case, every callback in |release_callback_map_| holds a |
| + // scoped_refptr of the compositor resource, so the compositor will never be |
|
piman
2014/06/19 20:44:04
Well, maybe that is the problem we should fix. Ess
Peng
2014/06/19 22:33:41
Done
|
| + // deleted. We have to ask the compositor resource host to release all layers, |
| + // and then all all release callbacks will be called, and then the compositor |
| + // resource will be deleted. |
| + Post(RENDERER, PpapiHostMsg_Compositor_Release()); |
| +} |
| + |
| void CompositorResource::OnPluginMsgCommitLayersReply( |
| const ResourceMessageReplyParams& params) { |
| if (!TrackedCallback::IsPending(commit_callback_)) |