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

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

Issue 6400007: Implement proxy for 3d-related interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: separate ParamTraits<gpu::CommandBuffer::State> into own library Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_PPB_SURFACE_3D_PROXY_H_
6 #define PPAPI_PPB_SURFACE_3D_PROXY_H_
7
8 #include <vector>
9
10 #include "ppapi/c/dev/pp_graphics_3d_dev.h"
11 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/cpp/completion_callback.h"
14 #include "ppapi/proxy/interface_proxy.h"
15 #include "ppapi/proxy/plugin_resource.h"
16 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
17
18 struct PPB_Surface3D_Dev;
19
20 namespace pp {
21 namespace proxy {
22
23 class Context3D;
24 class Surface3D : public PluginResource {
25 public:
26 explicit Surface3D(const HostResource& host_resource)
27 : PluginResource(host_resource),
28 resource_(0),
29 context_(NULL),
30 current_flush_callback_(PP_BlockUntilComplete()) {
31 }
32
33 // Resource overrides.
34 virtual Surface3D* AsSurface3D() { return this; }
35
36 bool is_flush_pending() const { return !!current_flush_callback_.func; }
37
38 PP_CompletionCallback current_flush_callback() const {
39 return current_flush_callback_;
40 }
41
42 void set_current_flush_callback(PP_CompletionCallback cb) {
43 current_flush_callback_ = cb;
44 }
45
46 void set_context(Context3D* context) {
47 context_ = context;
48 }
49
50 Context3D* context() const { return context_; }
51
52 void set_resource(PP_Resource resource) { resource_ = resource; }
53 PP_Resource resource() const { return resource_; }
54
55 private:
56 PP_Resource resource_;
57 Context3D* context_;
58 // In the plugin, this is the current callback set for Flushes. When the
59 // callback function pointer is non-NULL, we're waiting for a flush ACK.
60 PP_CompletionCallback current_flush_callback_;
61
62 DISALLOW_COPY_AND_ASSIGN(Surface3D);
63 };
64
65 class PPB_Surface3D_Proxy : public InterfaceProxy {
66 public:
67 PPB_Surface3D_Proxy(Dispatcher* dispatcher, const void* target_interface);
68 virtual ~PPB_Surface3D_Proxy();
69
70 const PPB_Surface3D_Dev* ppb_surface_3d_target() const {
71 return reinterpret_cast<const PPB_Surface3D_Dev*>(target_interface());
72 }
73
74 // InterfaceProxy implementation.
75 virtual const void* GetSourceInterface() const;
76 virtual InterfaceID GetInterfaceId() const;
77 virtual bool OnMessageReceived(const IPC::Message& msg);
78
79 private:
80 // Message handlers.
81 void OnMsgCreate(PP_Instance instance,
82 PP_Config3D_Dev config,
83 std::vector<int32_t> attribs,
84 HostResource* result);
85 void OnMsgSwapBuffers(const HostResource& surface);
86 // Renderer->plugin message handlers.
87 void OnMsgSwapBuffersACK(const HostResource& surface, int32_t pp_error);
88
89 void SendSwapBuffersACKToPlugin(int32_t result,
90 const HostResource& surface_3d);
91
92 CompletionCallbackFactory<PPB_Surface3D_Proxy,
93 ProxyNonThreadSafeRefCount> callback_factory_;
94 };
95
96 } // namespace proxy
97 } // namespace pp
98
99 #endif // PPAPI_PPB_SURFACE_3D_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698