Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1279)

Unified Diff: ppapi/proxy/compositor_layer_resource.h

Issue 298023004: [PPAPI] Compositor API implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor_api_def_new
Patch Set: Use a clip parent for clip_rect Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/proxy/compositor_layer_resource.h
diff --git a/ppapi/proxy/compositor_layer_resource.h b/ppapi/proxy/compositor_layer_resource.h
index b6205106229697fd3b150b116b6065822f0dcf8c..5babfd16ffd434e2ee345547aab1fd23088be37f 100644
--- a/ppapi/proxy/compositor_layer_resource.h
+++ b/ppapi/proxy/compositor_layer_resource.h
@@ -8,17 +8,32 @@
#include "ppapi/c/ppb_compositor_layer.h"
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/compositor_layer_data.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/thunk/ppb_compositor_layer_api.h"
namespace ppapi {
namespace proxy {
+class CompositorResource;
+
class PPAPI_PROXY_EXPORT CompositorLayerResource
: public PluginResource,
public thunk::PPB_CompositorLayer_API {
public:
+ // Release callback for texture or image layer.
+ typedef base::Callback<void(uint32_t, bool)> ReleaseCallback;
+
CompositorLayerResource(Connection connection,
- PP_Instance instance);
+ PP_Instance instance,
+ const CompositorResource* compositor);
+
+ const CompositorLayerData& data() const { return data_; }
+ const ReleaseCallback& release_callback() const {
+ return release_callback_;
+ }
+ void ResetReleaseCallback() { release_callback_.Reset(); }
+ void Invalidate() { compositor_ = NULL; }
private:
virtual ~CompositorLayerResource();
@@ -36,11 +51,11 @@ class PPAPI_PROXY_EXPORT CompositorLayerResource
PP_Resource context,
uint32_t texture,
const PP_Size* size,
- const scoped_refptr<ppapi::TrackedCallback>& callback) OVERRIDE;
+ const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
virtual int32_t SetImage(
PP_Resource image_data,
const PP_Size* size,
- const scoped_refptr<ppapi::TrackedCallback>& callback) OVERRIDE;
+ const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
virtual int32_t SetClipRect(const PP_Rect* rect) OVERRIDE;
virtual int32_t SetTransform(const float matrix[16]) OVERRIDE;
virtual int32_t SetOpacity(float opacity) OVERRIDE;
@@ -48,6 +63,40 @@ class PPAPI_PROXY_EXPORT CompositorLayerResource
virtual int32_t SetSourceRect(const PP_FloatRect* rect) OVERRIDE;
virtual int32_t SetPremultipliedAlpha(PP_Bool premult) OVERRIDE;
+ bool SetType(CompositorLayerData::Type type);
+ int32_t CheckForSetTextureAndImage(
+ CompositorLayerData::Type type,
+ const scoped_refptr<TrackedCallback>& release_callback);
+
+ // Release callbacks:
+ static void OnTextureReleased(
+ const ScopedPPResource& context,
+ uint32_t texture,
+ const scoped_refptr<TrackedCallback>& release_callback,
+ uint32_t sync_point,
+ bool is_lost);
+ static void OnImageReleased(
+ const ScopedPPResource& image,
+ const scoped_refptr<TrackedCallback>& release_callback,
+ uint32_t sync_point,
+ bool is_lost);
+
+ // The CompositorResource which own the layer. The layer is invalidated if
+ // compositor_ is NULL.
+ const CompositorResource* compositor_;
+
+ // Release callback for uncommitted texture or image. When CommitLayers() on
+ // the compositor_ is called, the callback will be copied into a map in the
+ // compositor_, and it will be reset to NULL.
+ ReleaseCallback release_callback_;
+
+ // Size of texture or image. It is used to verify the rect arg of
+ // SetSourceRect().
+ PP_FloatSize source_size_;
+
+ // Layer data.
+ CompositorLayerData data_;
+
DISALLOW_COPY_AND_ASSIGN(CompositorLayerResource);
};

Powered by Google App Engine
This is Rietveld 408576698