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

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

Issue 6400007: Implement proxy for 3d-related interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
« no previous file with comments | « ppapi/proxy/ppapi_messages_internal.h ('k') | ppapi/proxy/ppb_context_3d_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CONTEXT_3D_PROXY_H_
6 #define PPAPI_PPB_CONTEXT_3D_PROXY_H_
7
8 #include <vector>
9
10 #include "base/shared_memory.h"
11 #include "gpu/command_buffer/common/command_buffer.h"
12 #include "ppapi/c/dev/pp_graphics_3d_dev.h"
13 #include "ppapi/c/pp_instance.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_Context3D_Dev;
19 struct PPB_Context3DTrusted_Dev;
20
21 namespace gpu {
22 class CommandBuffer;
23
24 namespace gles2 {
25 class GLES2CmdHelper;
26 class GLES2Implementation;
27 } // namespace gles2
28
29 } // namespace gpu
30
31 namespace pp {
32 namespace proxy {
33
34 class Surface3D;
35
36 class Context3D : public PluginResource {
37 public:
38 explicit Context3D(const HostResource& resource);
39 virtual ~Context3D();
40
41 // Resource overrides.
42 virtual Context3D* AsContext3D() { return this; }
43
44 bool CreateImplementation();
45
46 Surface3D* get_draw_surface() const {
47 return draw_;
48 }
49
50 Surface3D* get_read_surface() const {
51 return read_;
52 }
53
54 void BindSurfaces(Surface3D* draw, Surface3D* read);
55
56 gpu::gles2::GLES2Implementation* gles2_impl() const {
57 return gles2_impl_.get();
58 }
59
60 private:
61 Surface3D* draw_;
62 Surface3D* read_;
63
64 scoped_ptr<gpu::CommandBuffer> command_buffer_;
65 scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_;
66 int32 transfer_buffer_id_;
67 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_;
68
69 DISALLOW_COPY_AND_ASSIGN(Context3D);
70 };
71
72 class PPB_Context3D_Proxy : public InterfaceProxy {
73 public:
74 PPB_Context3D_Proxy(Dispatcher* dispatcher, const void* target_interface);
75 virtual ~PPB_Context3D_Proxy();
76
77 const PPB_Context3D_Dev* ppb_context_3d_target() const {
78 return reinterpret_cast<const PPB_Context3D_Dev*>(target_interface());
79 }
80 const PPB_Context3DTrusted_Dev* ppb_context_3d_trusted() const;
81
82 // InterfaceProxy implementation.
83 virtual const void* GetSourceInterface() const;
84 virtual InterfaceID GetInterfaceId() const;
85 virtual bool OnMessageReceived(const IPC::Message& msg);
86
87 private:
88 void OnMsgCreate(PP_Instance instance,
89 PP_Config3D_Dev config,
90 std::vector<int32_t> attribs,
91 HostResource* result);
92 void OnMsgBindSurfaces(const HostResource& context,
93 const HostResource& draw,
94 const HostResource& read,
95 int32_t* result);
96 void OnMsgInitialize(const HostResource& context,
97 int32 size,
98 base::SharedMemoryHandle* ring_buffer);
99 void OnMsgGetState(const HostResource& context,
100 gpu::CommandBuffer::State* state);
101 void OnMsgFlush(const HostResource& context,
102 int32 put_offset,
103 gpu::CommandBuffer::State* state);
104 void OnMsgAsyncFlush(const HostResource& context,
105 int32 put_offset);
106 void OnMsgCreateTransferBuffer(const HostResource& context,
107 int32 size,
108 int32* id);
109 void OnMsgDestroyTransferBuffer(const HostResource& context,
110 int32 id);
111 void OnMsgGetTransferBuffer(const HostResource& context,
112 int32 id,
113 base::SharedMemoryHandle* transfer_buffer,
114 uint32* size);
115 };
116
117 } // namespace proxy
118 } // namespace pp
119
120 #endif // PPAPI_PPB_CONTEXT_3D_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_messages_internal.h ('k') | ppapi/proxy/ppb_context_3d_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698