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

Side by Side Diff: ppapi/proxy/compositor_layer_resource.h

Issue 324983005: [PPAPI] Add browser tests for compositor API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor_api_impl_new
Patch Set: Update 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 unified diff | Download patch
OLDNEW
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_LAYER_RESOURCE_H_ 5 #ifndef PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_
6 #define PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_ 6 #define PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_
7 7
8 #include "ppapi/c/ppb_compositor_layer.h" 8 #include "ppapi/c/ppb_compositor_layer.h"
9 #include "ppapi/proxy/plugin_resource.h" 9 #include "ppapi/proxy/plugin_resource.h"
10 #include "ppapi/proxy/ppapi_proxy_export.h" 10 #include "ppapi/proxy/ppapi_proxy_export.h"
11 #include "ppapi/shared_impl/compositor_layer_data.h" 11 #include "ppapi/shared_impl/compositor_layer_data.h"
12 #include "ppapi/shared_impl/scoped_pp_resource.h" 12 #include "ppapi/shared_impl/scoped_pp_resource.h"
13 #include "ppapi/thunk/ppb_compositor_layer_api.h" 13 #include "ppapi/thunk/ppb_compositor_layer_api.h"
14 14
15 namespace ppapi { 15 namespace ppapi {
16 namespace proxy { 16 namespace proxy {
17 17
18 class CompositorResource; 18 class CompositorResource;
19 19
20 class PPAPI_PROXY_EXPORT CompositorLayerResource 20 class PPAPI_PROXY_EXPORT CompositorLayerResource
21 : public PluginResource, 21 : public PluginResource,
22 public thunk::PPB_CompositorLayer_API { 22 public thunk::PPB_CompositorLayer_API {
23 public: 23 public:
24 // Release callback for texture or image layer. 24 // Release callback for texture or image layer.
25 typedef base::Callback<void(uint32_t, bool)> ReleaseCallback; 25 typedef base::Callback<void(uint32_t, bool)> ReleaseCallback;
26 26
27 CompositorLayerResource(Connection connection, 27 CompositorLayerResource(Connection connection,
28 PP_Instance instance, 28 PP_Instance instance,
29 const CompositorResource* compositor); 29 scoped_refptr<CompositorResource> compositor);
30 30
31 const CompositorLayerData& data() const { return data_; } 31 const CompositorLayerData& data() const { return data_; }
32 const ReleaseCallback& release_callback() const { 32 const ReleaseCallback& release_callback() const {
33 return release_callback_; 33 return release_callback_;
34 } 34 }
35 void ResetReleaseCallback() { release_callback_.Reset(); } 35 void ResetReleaseCallback() { release_callback_.Reset(); }
36 void Invalidate() { compositor_ = NULL; } 36 void Invalidate() { compositor_ = NULL; }
37 37
38 private: 38 private:
39 enum LayerType { 39 enum LayerType {
(...skipping 29 matching lines...) Expand all
69 virtual int32_t SetSourceRect(const PP_FloatRect* rect) OVERRIDE; 69 virtual int32_t SetSourceRect(const PP_FloatRect* rect) OVERRIDE;
70 virtual int32_t SetPremultipliedAlpha(PP_Bool premult) OVERRIDE; 70 virtual int32_t SetPremultipliedAlpha(PP_Bool premult) OVERRIDE;
71 71
72 bool SetType(LayerType type); 72 bool SetType(LayerType type);
73 int32_t CheckForSetTextureAndImage( 73 int32_t CheckForSetTextureAndImage(
74 LayerType type, 74 LayerType type,
75 const scoped_refptr<TrackedCallback>& release_callback); 75 const scoped_refptr<TrackedCallback>& release_callback);
76 76
77 // The CompositorResource which own the layer. The layer is invalidated if 77 // The CompositorResource which own the layer. The layer is invalidated if
78 // compositor_ is NULL. 78 // compositor_ is NULL.
79 const CompositorResource* compositor_; 79 scoped_refptr<CompositorResource> compositor_;
80 80
81 // Release callback for uncommitted texture or image. When CommitLayers() on 81 // Release callback for uncommitted texture or image. When CommitLayers() on
82 // the compositor_ is called, the callback will be copied into a map in the 82 // the compositor_ is called, the callback will be copied into a map in the
83 // compositor_, and it will be reset to NULL. 83 // compositor_, and it will be reset to NULL.
84 ReleaseCallback release_callback_; 84 ReleaseCallback release_callback_;
85 85
86 // Size of texture or image. It is used to verify the rect arg of 86 // Size of texture or image. It is used to verify the rect arg of
87 // SetSourceRect(). 87 // SetSourceRect().
88 PP_FloatSize source_size_; 88 PP_FloatSize source_size_;
89 89
90 // Layer data. 90 // Layer data.
91 CompositorLayerData data_; 91 CompositorLayerData data_;
92 92
93 DISALLOW_COPY_AND_ASSIGN(CompositorLayerResource); 93 DISALLOW_COPY_AND_ASSIGN(CompositorLayerResource);
94 }; 94 };
95 95
96 } // namespace proxy 96 } // namespace proxy
97 } // namespace ppapi 97 } // namespace ppapi
98 98
99 #endif // PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_ 99 #endif // PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698