| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PPAPI_PROXY_COMPOSITOR_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_COMPOSITOR_RESOURCE_H_ |
| 6 #define PPAPI_PROXY_COMPOSITOR_RESOURCE_H_ | 6 #define PPAPI_PROXY_COMPOSITOR_RESOURCE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "ppapi/proxy/compositor_layer_resource.h" | 10 #include "ppapi/proxy/compositor_layer_resource.h" |
| 11 #include "ppapi/proxy/plugin_resource.h" | 11 #include "ppapi/proxy/plugin_resource.h" |
| 12 #include "ppapi/proxy/ppapi_proxy_export.h" | 12 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 13 #include "ppapi/shared_impl/proxy_lock.h" | 13 #include "ppapi/shared_impl/proxy_lock.h" |
| 14 #include "ppapi/thunk/ppb_compositor_api.h" | 14 #include "ppapi/thunk/ppb_compositor_api.h" |
| 15 | 15 |
| 16 namespace gpu { |
| 17 struct SyncToken; |
| 18 } |
| 19 |
| 16 namespace ppapi { | 20 namespace ppapi { |
| 17 namespace proxy { | 21 namespace proxy { |
| 18 | 22 |
| 19 class PPAPI_PROXY_EXPORT CompositorResource | 23 class PPAPI_PROXY_EXPORT CompositorResource |
| 20 : public PluginResource, | 24 : public PluginResource, |
| 21 public thunk::PPB_Compositor_API { | 25 public thunk::PPB_Compositor_API { |
| 22 public: | 26 public: |
| 23 CompositorResource(Connection connection, | 27 CompositorResource(Connection connection, |
| 24 PP_Instance instance); | 28 PP_Instance instance); |
| 25 | 29 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 void OnReplyReceived(const ResourceMessageReplyParams& params, | 41 void OnReplyReceived(const ResourceMessageReplyParams& params, |
| 38 const IPC::Message& msg) override; | 42 const IPC::Message& msg) override; |
| 39 | 43 |
| 40 // thunk::PPB_Compositor_API overrides: | 44 // thunk::PPB_Compositor_API overrides: |
| 41 PP_Resource AddLayer() override; | 45 PP_Resource AddLayer() override; |
| 42 int32_t CommitLayers(const scoped_refptr<TrackedCallback>& callback) override; | 46 int32_t CommitLayers(const scoped_refptr<TrackedCallback>& callback) override; |
| 43 int32_t ResetLayers() override; | 47 int32_t ResetLayers() override; |
| 44 | 48 |
| 45 // IPC msg handlers: | 49 // IPC msg handlers: |
| 46 void OnPluginMsgCommitLayersReply(const ResourceMessageReplyParams& params); | 50 void OnPluginMsgCommitLayersReply(const ResourceMessageReplyParams& params); |
| 47 void OnPluginMsgReleaseResource( | 51 void OnPluginMsgReleaseResource(const ResourceMessageReplyParams& params, |
| 48 const ResourceMessageReplyParams& params, | 52 int32_t id, |
| 49 int32_t id, | 53 uint32_t sync_point, |
| 50 uint32_t sync_point, | 54 const gpu::SyncToken& sync_token, |
| 51 bool is_lost); | 55 bool is_lost); |
| 52 | 56 |
| 53 void ResetLayersInternal(bool is_aborted); | 57 void ResetLayersInternal(bool is_aborted); |
| 54 | 58 |
| 55 // Callback for CommitLayers(). | 59 // Callback for CommitLayers(). |
| 56 scoped_refptr<TrackedCallback> commit_callback_; | 60 scoped_refptr<TrackedCallback> commit_callback_; |
| 57 | 61 |
| 58 // True if layers_ has been reset by ResetLayers(). | 62 // True if layers_ has been reset by ResetLayers(). |
| 59 bool layer_reset_; | 63 bool layer_reset_; |
| 60 | 64 |
| 61 // Layer stack. | 65 // Layer stack. |
| 62 typedef std::vector<scoped_refptr<CompositorLayerResource> > LayerList; | 66 typedef std::vector<scoped_refptr<CompositorLayerResource> > LayerList; |
| 63 LayerList layers_; | 67 LayerList layers_; |
| 64 | 68 |
| 65 // Release callback map for texture and image. | 69 // Release callback map for texture and image. |
| 66 typedef CompositorLayerResource::ReleaseCallback ReleaseCallback; | 70 typedef CompositorLayerResource::ReleaseCallback ReleaseCallback; |
| 67 typedef std::map<int32_t, ReleaseCallback> ReleaseCallbackMap; | 71 typedef std::map<int32_t, ReleaseCallback> ReleaseCallbackMap; |
| 68 ReleaseCallbackMap release_callback_map_; | 72 ReleaseCallbackMap release_callback_map_; |
| 69 | 73 |
| 70 // The last resource id for texture or image. | 74 // The last resource id for texture or image. |
| 71 mutable int32_t last_resource_id_; | 75 mutable int32_t last_resource_id_; |
| 72 | 76 |
| 73 DISALLOW_COPY_AND_ASSIGN(CompositorResource); | 77 DISALLOW_COPY_AND_ASSIGN(CompositorResource); |
| 74 }; | 78 }; |
| 75 | 79 |
| 76 } // namespace proxy | 80 } // namespace proxy |
| 77 } // namespace ppapi | 81 } // namespace ppapi |
| 78 | 82 |
| 79 #endif // PPAPI_PROXY_COMPOSITOR_RESOURCE_H_ | 83 #endif // PPAPI_PROXY_COMPOSITOR_RESOURCE_H_ |
| OLD | NEW |