Fix iOS build for XCode 4.6.
[chromium-blink-merge.git] / ppapi / proxy / ppapi_command_buffer_proxy.h
blobd1aac55b3ea8b6f4b5b5c9d8777c83b7c7b13e60
1 // Copyright (c) 2012 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.
5 #ifndef PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_
6 #define PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_
8 #include "base/callback.h"
9 #include "base/hash_tables.h"
10 #include "gpu/command_buffer/common/command_buffer.h"
11 #include "ppapi/proxy/ppapi_proxy_export.h"
12 #include "ppapi/shared_impl/host_resource.h"
13 #include "gpu/ipc/command_buffer_proxy.h"
15 namespace IPC {
16 class Message;
19 namespace ppapi {
20 namespace proxy {
22 class ProxyChannel;
24 class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public CommandBufferProxy {
25 public:
26 PpapiCommandBufferProxy(const HostResource& resource,
27 ProxyChannel* channel);
28 virtual ~PpapiCommandBufferProxy();
30 void ReportChannelError();
32 // CommandBufferProxy implementation:
33 virtual int GetRouteID() const OVERRIDE;
34 virtual bool Echo(const base::Closure& callback) OVERRIDE;
35 virtual bool SetParent(CommandBufferProxy* parent_command_buffer,
36 uint32 parent_texture_id) OVERRIDE;
37 virtual void SetChannelErrorCallback(const base::Closure& callback) OVERRIDE;
39 // gpu::CommandBuffer implementation:
40 virtual bool Initialize();
41 virtual State GetState();
42 virtual State GetLastState();
43 virtual void Flush(int32 put_offset);
44 virtual State FlushSync(int32 put_offset, int32 last_known_get);
45 virtual void SetGetBuffer(int32 transfer_buffer_id);
46 virtual void SetGetOffset(int32 get_offset);
47 virtual gpu::Buffer CreateTransferBuffer(size_t size, int32* id);
48 virtual void DestroyTransferBuffer(int32 id);
49 virtual gpu::Buffer GetTransferBuffer(int32 id);
50 virtual void SetToken(int32 token);
51 virtual void SetParseError(gpu::error::Error error);
52 virtual void SetContextLostReason(gpu::error::ContextLostReason reason);
54 private:
55 bool Send(IPC::Message* msg);
56 void UpdateState(const gpu::CommandBuffer::State& state, bool success);
58 typedef base::hash_map<int32, gpu::Buffer> TransferBufferMap;
59 TransferBufferMap transfer_buffers_;
61 State last_state_;
63 HostResource resource_;
64 ProxyChannel* channel_;
66 base::Closure channel_error_callback_;
68 DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy);
71 } // namespace proxy
72 } // namespace ppapi
74 #endif // PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_