1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_COMPOSITOR_RESOURCE_H_
6 #define PPAPI_PROXY_COMPOSITOR_RESOURCE_H_
10 #include "ppapi/proxy/compositor_layer_resource.h"
11 #include "ppapi/proxy/plugin_resource.h"
12 #include "ppapi/proxy/ppapi_proxy_export.h"
13 #include "ppapi/shared_impl/proxy_lock.h"
14 #include "ppapi/thunk/ppb_compositor_api.h"
19 class PPAPI_PROXY_EXPORT CompositorResource
20 : public PluginResource
,
21 public thunk::PPB_Compositor_API
{
23 CompositorResource(Connection connection
,
24 PP_Instance instance
);
26 bool IsInProgress() const;
28 int32_t GenerateResourceId() const;
31 ~CompositorResource() override
;
33 // Resource overrides:
34 thunk::PPB_Compositor_API
* AsPPB_Compositor_API() override
;
36 // PluginResource overrides:
37 void OnReplyReceived(const ResourceMessageReplyParams
& params
,
38 const IPC::Message
& msg
) override
;
40 // thunk::PPB_Compositor_API overrides:
41 PP_Resource
AddLayer() override
;
42 int32_t CommitLayers(const scoped_refptr
<TrackedCallback
>& callback
) override
;
43 int32_t ResetLayers() override
;
46 void OnPluginMsgCommitLayersReply(const ResourceMessageReplyParams
& params
);
47 void OnPluginMsgReleaseResource(
48 const ResourceMessageReplyParams
& params
,
53 void ResetLayersInternal(bool is_aborted
);
55 // Callback for CommitLayers().
56 scoped_refptr
<TrackedCallback
> commit_callback_
;
58 // True if layers_ has been reset by ResetLayers().
62 typedef std::vector
<scoped_refptr
<CompositorLayerResource
> > LayerList
;
65 // Release callback map for texture and image.
66 typedef CompositorLayerResource::ReleaseCallback ReleaseCallback
;
67 typedef std::map
<int32_t, ReleaseCallback
> ReleaseCallbackMap
;
68 ReleaseCallbackMap release_callback_map_
;
70 // The last resource id for texture or image.
71 mutable int32_t last_resource_id_
;
73 DISALLOW_COPY_AND_ASSIGN(CompositorResource
);
79 #endif // PPAPI_PROXY_COMPOSITOR_RESOURCE_H_