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

Side by Side Diff: ppapi/proxy/compositor_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: Fix review issues 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_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/thunk/ppb_compositor_api.h" 14 #include "ppapi/thunk/ppb_compositor_api.h"
14 15
15 namespace ppapi { 16 namespace ppapi {
16 namespace proxy { 17 namespace proxy {
17 18
18 class PPAPI_PROXY_EXPORT CompositorResource 19 class PPAPI_PROXY_EXPORT CompositorResource
19 : public PluginResource, 20 : public PluginResource,
20 public thunk::PPB_Compositor_API { 21 public thunk::PPB_Compositor_API {
21 public: 22 public:
22 CompositorResource(Connection connection, 23 CompositorResource(Connection connection,
23 PP_Instance instance); 24 PP_Instance instance);
24 25
25 bool IsInProgress() const { 26 bool IsInProgress() const {
27 ProxyLock::AssertAcquiredDebugOnly();
26 return TrackedCallback::IsPending(commit_callback_); 28 return TrackedCallback::IsPending(commit_callback_);
27 } 29 }
28 30
31 bool bound_to_instance() const {
32 ProxyLock::AssertAcquiredDebugOnly();
33 return bound_to_instance_;
34 }
35
29 int32_t GenerateResourceId() const { 36 int32_t GenerateResourceId() const {
37 ProxyLock::AssertAcquiredDebugOnly();
30 return ++last_resource_id_; 38 return ++last_resource_id_;
31 } 39 }
raymes 2014/06/18 05:58:44 nit: Could you move these to the implementation?
Peng 2014/06/18 11:14:37 Move it on cc file? Done
raymes 2014/06/19 00:39:13 The same with the above 2 methods.
Peng 2014/06/19 17:35:11 Done.
32 40
33 private: 41 private:
34 virtual ~CompositorResource(); 42 virtual ~CompositorResource();
35 43
36 // Resource overrides: 44 // Resource overrides:
37 virtual thunk::PPB_Compositor_API* AsPPB_Compositor_API() OVERRIDE; 45 virtual thunk::PPB_Compositor_API* AsPPB_Compositor_API() OVERRIDE;
38 46
39 // PluginResource overrides: 47 // PluginResource overrides:
48 virtual void NotifyLastPluginRefWasDeleted() OVERRIDE;
40 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, 49 virtual void OnReplyReceived(const ResourceMessageReplyParams& params,
41 const IPC::Message& msg) OVERRIDE; 50 const IPC::Message& msg) OVERRIDE;
42 51
43 // thunk::PPB_Compositor_API overrides: 52 // thunk::PPB_Compositor_API overrides:
44 virtual PP_Resource AddLayer() OVERRIDE; 53 virtual PP_Resource AddLayer() OVERRIDE;
45 virtual int32_t CommitLayers( 54 virtual int32_t CommitLayers(
46 const scoped_refptr<TrackedCallback>& callback) OVERRIDE; 55 const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
47 virtual int32_t ResetLayers() OVERRIDE; 56 virtual int32_t ResetLayers() OVERRIDE;
57 virtual void BindToInstance(bool bound) OVERRIDE;
48 58
49 // IPC msg handlers: 59 // IPC msg handlers:
50 void OnPluginMsgCommitLayersReply(const ResourceMessageReplyParams& params); 60 void OnPluginMsgCommitLayersReply(const ResourceMessageReplyParams& params);
51 void OnPluginMsgReleaseResource( 61 void OnPluginMsgReleaseResource(
52 const ResourceMessageReplyParams& params, 62 const ResourceMessageReplyParams& params,
53 int32_t id, 63 int32_t id,
54 uint32_t sync_point, 64 uint32_t sync_point,
55 bool is_lost); 65 bool is_lost);
56 66
57 void ResetLayersInternal(); 67 void ResetLayersInternal();
58 68
59 // Callback for CommitLayers(). 69 // Callback for CommitLayers().
60 scoped_refptr<TrackedCallback> commit_callback_; 70 scoped_refptr<TrackedCallback> commit_callback_;
61 71
62 // True if layers_ has been reset by ResetLayers(). 72 // True if layers_ has been reset by ResetLayers().
63 bool layer_reset_; 73 bool layer_reset_;
64 74
65 // Layer stack. 75 // Layer stack.
66 typedef std::vector<scoped_refptr<CompositorLayerResource> > LayerList; 76 typedef std::vector<scoped_refptr<CompositorLayerResource> > LayerList;
67 LayerList layers_; 77 LayerList layers_;
68 78
69 // Release callback map for texture and image. 79 // Release callback map for texture and image.
70 typedef CompositorLayerResource::ReleaseCallback ReleaseCallback; 80 typedef CompositorLayerResource::ReleaseCallback ReleaseCallback;
71 typedef std::map<int32_t, ReleaseCallback> ReleaseCallbackMap; 81 typedef std::map<int32_t, ReleaseCallback> ReleaseCallbackMap;
72 ReleaseCallbackMap release_callback_map_; 82 ReleaseCallbackMap release_callback_map_;
73 83
84 bool bound_to_instance_;
85
74 // The last resource id for texture or image. 86 // The last resource id for texture or image.
75 mutable int32_t last_resource_id_; 87 mutable int32_t last_resource_id_;
76 88
77 DISALLOW_COPY_AND_ASSIGN(CompositorResource); 89 DISALLOW_COPY_AND_ASSIGN(CompositorResource);
78 }; 90 };
79 91
80 } // namespace proxy 92 } // namespace proxy
81 } // namespace ppapi 93 } // namespace ppapi
82 94
83 #endif // PPAPI_PROXY_COMPOSITOR_RESOURCE_H_ 95 #endif // PPAPI_PROXY_COMPOSITOR_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698