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

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

Issue 6824006: Completed the implementation for PPB_Graphics3D interface. Mostly copied from the implementations... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_PROXY_PPB_GRAPHICS_3D_PROXY_H_
6 #define PPAPI_PROXY_PPB_GRAPHICS_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/cpp/completion_callback.h"
15 #include "ppapi/proxy/interface_proxy.h"
16 #include "ppapi/proxy/plugin_resource.h"
17 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
18 #include "ppapi/shared_impl/graphics_3d_impl.h"
19
20 namespace pp {
21 namespace proxy {
22
23 class HostResource;
24
25 class Graphics3D : public PluginResource,
26 public ppapi::Graphics3DImpl {
27 public:
28 explicit Graphics3D(const HostResource& resource);
29 virtual ~Graphics3D();
30
31 bool Init();
32
33 // PluginResource overrides.
34 virtual ::ppapi::thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() OVERRIDE {
35 return this;
36 }
37
38 // Graphics3DTrusted API. These are not implemented in the proxy.
39 virtual PP_Bool InitCommandBuffer(int32_t size) OVERRIDE;
40 virtual PP_Bool GetRingBuffer(int* shm_handle, uint32_t* shm_size) OVERRIDE;
41 virtual PP_Graphics3DTrustedState GetState() OVERRIDE;
42 virtual PP_Bool Flush(int32_t put_offset) OVERRIDE;
43 virtual PP_Graphics3DTrustedState FlushSync(int32_t put_offset) OVERRIDE;
44 virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE;
45 virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE;
46 virtual PP_Bool GetTransferBuffer(int32_t id,
47 int* shm_handle,
48 uint32_t* shm_size) OVERRIDE;
49 virtual PP_Graphics3DTrustedState FlushSyncFast(
50 int32_t put_offset,
51 int32_t last_known_get) OVERRIDE;
52
53 protected:
54 // ppapi::Graphics3DImpl overrides.
55 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE;
56 virtual int32 DoSwapBuffers();
57
58 private:
59 scoped_ptr<gpu::CommandBuffer> command_buffer_;
60 };
61
62 class PPB_Graphics3D_Proxy : public InterfaceProxy {
63 public:
64 PPB_Graphics3D_Proxy(Dispatcher* dispatcher, const void* target_interface);
65 virtual ~PPB_Graphics3D_Proxy();
66
67 static const Info* GetInfo();
68
69 static PP_Resource Create(PP_Instance instance,
70 PP_Config3D_Dev config,
71 PP_Resource share_context,
72 const int32_t* attrib_list);
73
74 // InterfaceProxy implementation.
75 virtual bool OnMessageReceived(const IPC::Message& msg);
76
77 private:
78 void OnMsgCreate(PP_Instance instance,
79 PP_Config3D_Dev config,
80 const std::vector<int32_t>& attribs,
81 HostResource* result);
82 void OnMsgInitCommandBuffer(const HostResource& context,
83 int32 size,
84 base::SharedMemoryHandle* ring_buffer);
85 void OnMsgGetState(const HostResource& context,
86 gpu::CommandBuffer::State* state);
87 void OnMsgFlush(const HostResource& context,
88 int32 put_offset,
89 int32 last_known_get,
90 gpu::CommandBuffer::State* state);
91 void OnMsgAsyncFlush(const HostResource& context,
92 int32 put_offset);
93 void OnMsgCreateTransferBuffer(const HostResource& context,
94 int32 size,
95 int32* id);
96 void OnMsgDestroyTransferBuffer(const HostResource& context,
97 int32 id);
98 void OnMsgGetTransferBuffer(const HostResource& context,
99 int32 id,
100 base::SharedMemoryHandle* transfer_buffer,
101 uint32* size);
102 void OnMsgSwapBuffers(const HostResource& context);
103 // Renderer->plugin message handlers.
104 void OnMsgSwapBuffersACK(const HostResource& context, int32_t pp_error);
105
106 void SendSwapBuffersACKToPlugin(int32_t result,
107 const HostResource& context);
108
109 CompletionCallbackFactory<PPB_Graphics3D_Proxy,
110 ProxyNonThreadSafeRefCount> callback_factory_;
111 };
112
113 } // namespace proxy
114 } // namespace pp
115
116 #endif // PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698