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

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

Issue 8676042: Remove Context3D/Surface3D (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style Created 9 years 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/ppb_context_3d_proxy.cc ('k') | ppapi/proxy/ppb_surface_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) 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_SURFACE_3D_PROXY_H_
6 #define PPAPI_PROXY_PPB_SURFACE_3D_PROXY_H_
7
8 #include <vector>
9
10 #include "ppapi/c/pp_completion_callback.h"
11 #include "ppapi/c/pp_graphics_3d.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/proxy_non_thread_safe_ref_count.h"
16 #include "ppapi/shared_impl/resource.h"
17 #include "ppapi/thunk/ppb_surface_3d_api.h"
18
19 namespace ppapi {
20 namespace proxy {
21
22 class Context3D;
23
24 class Surface3D : public ppapi::Resource,
25 public ppapi::thunk::PPB_Surface3D_API {
26 public:
27 explicit Surface3D(const ppapi::HostResource& host_resource);
28 virtual ~Surface3D();
29
30 // Resource overrides.
31 virtual PPB_Surface3D_API* AsPPB_Surface3D_API() OVERRIDE;
32
33 // PPB_Surface3D_API implementation.
34 virtual int32_t SetAttrib(int32_t attribute, int32_t value) OVERRIDE;
35 virtual int32_t GetAttrib(int32_t attribute, int32_t* value) OVERRIDE;
36 virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE;
37
38 void SwapBuffersACK(int32_t pp_error);
39
40 bool is_flush_pending() const { return !!current_flush_callback_.func; }
41
42 PP_CompletionCallback current_flush_callback() const {
43 return current_flush_callback_;
44 }
45
46 void set_context(Context3D* context) {
47 context_ = context;
48 }
49
50 Context3D* context() const { return context_; }
51
52 private:
53 Context3D* context_;
54
55 // In the plugin, this is the current callback set for Flushes. When the
56 // callback function pointer is non-NULL, we're waiting for a flush ACK.
57 PP_CompletionCallback current_flush_callback_;
58
59 DISALLOW_COPY_AND_ASSIGN(Surface3D);
60 };
61
62 class PPB_Surface3D_Proxy : public InterfaceProxy {
63 public:
64 explicit PPB_Surface3D_Proxy(Dispatcher* dispatcher);
65 virtual ~PPB_Surface3D_Proxy();
66
67 static const Info* GetInfo();
68
69 static PP_Resource CreateProxyResource(PP_Instance instance,
70 PP_Config3D_Dev config,
71 const int32_t* attrib_list);
72
73 // InterfaceProxy implementation.
74 virtual bool OnMessageReceived(const IPC::Message& msg);
75
76 static const ApiID kApiID = API_ID_PPB_SURFACE_3D;
77
78 private:
79 // Message handlers.
80 void OnMsgCreate(PP_Instance instance,
81 PP_Config3D_Dev config,
82 const std::vector<int32_t>& attribs,
83 ppapi::HostResource* result);
84 void OnMsgSwapBuffers(const ppapi::HostResource& surface);
85 // Renderer->plugin message handlers.
86 void OnMsgSwapBuffersACK(const ppapi::HostResource& surface,
87 int32_t pp_error);
88
89 void SendSwapBuffersACKToPlugin(int32_t result,
90 const ppapi::HostResource& surface_3d);
91
92 pp::CompletionCallbackFactory<PPB_Surface3D_Proxy,
93 ProxyNonThreadSafeRefCount> callback_factory_;
94 };
95
96 } // namespace proxy
97 } // namespace ppapi
98
99 #endif // PPAPI_PROXY_PPB_SURFACE_3D_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_context_3d_proxy.cc ('k') | ppapi/proxy/ppb_surface_3d_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698