Chromium Code Reviews| 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> | |
| 9 | |
| 10 #include "ppapi/proxy/compositor_layer_resource.h" | |
| 8 #include "ppapi/proxy/plugin_resource.h" | 11 #include "ppapi/proxy/plugin_resource.h" |
| 9 #include "ppapi/proxy/ppapi_proxy_export.h" | 12 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 10 #include "ppapi/thunk/ppb_compositor_api.h" | 13 #include "ppapi/thunk/ppb_compositor_api.h" |
| 11 | 14 |
| 12 namespace ppapi { | 15 namespace ppapi { |
| 13 namespace proxy { | 16 namespace proxy { |
| 14 | 17 |
| 15 class PPAPI_PROXY_EXPORT CompositorResource | 18 class PPAPI_PROXY_EXPORT CompositorResource |
| 16 : public PluginResource, | 19 : public PluginResource, |
| 17 public thunk::PPB_Compositor_API { | 20 public thunk::PPB_Compositor_API { |
| 18 public: | 21 public: |
| 19 CompositorResource(Connection connection, | 22 CompositorResource(Connection connection, |
| 20 PP_Instance instance); | 23 PP_Instance instance); |
| 21 | 24 |
| 25 bool IsInProgress() const { | |
| 26 return TrackedCallback::IsPending(commit_callback_); | |
| 27 } | |
| 28 | |
| 29 int32_t GenerateResourceId() const { | |
| 30 return ++last_resource_id_; | |
| 31 } | |
| 32 | |
| 22 private: | 33 private: |
| 23 virtual ~CompositorResource(); | 34 virtual ~CompositorResource(); |
| 24 | 35 |
| 25 // Resource overrides: | 36 // Resource overrides: |
| 26 virtual thunk::PPB_Compositor_API* AsPPB_Compositor_API() OVERRIDE; | 37 virtual thunk::PPB_Compositor_API* AsPPB_Compositor_API() OVERRIDE; |
| 27 | 38 |
| 39 // PluginResource overrides: | |
| 40 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, | |
| 41 const IPC::Message& msg) OVERRIDE; | |
| 42 | |
| 28 // thunk::PPB_Compositor_API overrides: | 43 // thunk::PPB_Compositor_API overrides: |
| 29 virtual PP_Resource AddLayer() OVERRIDE; | 44 virtual PP_Resource AddLayer() OVERRIDE; |
| 30 virtual int32_t CommitLayers( | 45 virtual int32_t CommitLayers( |
| 31 const scoped_refptr<ppapi::TrackedCallback>& callback) OVERRIDE; | 46 const scoped_refptr<TrackedCallback>& callback) OVERRIDE; |
| 32 virtual int32_t ResetLayers() OVERRIDE; | 47 virtual int32_t ResetLayers() OVERRIDE; |
| 33 | 48 |
| 49 // IPC msg handlers: | |
| 50 void OnPluginMsgCommitLayersReply(const ResourceMessageReplyParams& params); | |
| 51 void OnPluginMsgReleaseResource( | |
| 52 const ResourceMessageReplyParams& params, | |
| 53 int32_t id, | |
| 54 uint32_t sync_point, | |
| 55 bool is_lost); | |
| 56 | |
| 57 // Callback for CommitLayers(). | |
| 58 scoped_refptr<TrackedCallback> commit_callback_; | |
| 59 | |
| 60 // True if layers_ has been reset by ResetLayers(). | |
| 61 bool layer_reset_; | |
| 62 | |
| 63 // Layer stack. | |
| 64 typedef std::vector<scoped_refptr<CompositorLayerResource> > LayerList; | |
| 65 LayerList layers_; | |
| 66 | |
| 67 // Release callback map for texture and image. | |
| 68 typedef CompositorLayerResource::ReleaseCallback ReleaseCallback; | |
| 69 typedef std::map<int32_t, ReleaseCallback> ReleaseCallbackMap; | |
| 70 ReleaseCallbackMap release_callback_map_; | |
| 71 | |
| 72 // The last resource id for texture or image. | |
| 73 mutable int32_t last_resource_id_; | |
|
raymes
2014/06/04 01:11:39
Why is this mutable?
Peng
2014/06/05 00:50:38
In CompositorLayerResource(CLR), we use a const Co
| |
| 74 | |
| 34 DISALLOW_COPY_AND_ASSIGN(CompositorResource); | 75 DISALLOW_COPY_AND_ASSIGN(CompositorResource); |
| 35 }; | 76 }; |
| 36 | 77 |
| 37 } // namespace proxy | 78 } // namespace proxy |
| 38 } // namespace ppapi | 79 } // namespace ppapi |
| 39 | 80 |
| 40 #endif // PPAPI_PROXY_COMPOSITOR_RESOURCE_H_ | 81 #endif // PPAPI_PROXY_COMPOSITOR_RESOURCE_H_ |
| OLD | NEW |