summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppapi_command_buffer_proxy.h
diff options
context:
space:
mode:
authorfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-08 12:30:13 +0000
committerfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-08 12:30:13 +0000
commitaaa11b3c9bb3d4f786f41c22aeb55abdc119a5d0 (patch)
tree91296cbf293597f25e131f1c66679bc27cf02df2 /ppapi/proxy/ppapi_command_buffer_proxy.h
parentc8332f2737d0a0f9f3de94b0100e5a890b78dc4b (diff)
downloadchromium_src-aaa11b3c9bb3d4f786f41c22aeb55abdc119a5d0.zip
chromium_src-aaa11b3c9bb3d4f786f41c22aeb55abdc119a5d0.tar.gz
chromium_src-aaa11b3c9bb3d4f786f41c22aeb55abdc119a5d0.tar.bz2
Factor out the command buffer implementation in ppb_graphics_3d_proxy so that it is more general (does not depend on a dispatcher) and can be used elsewhere.
BUG=none TEST=manually Review URL: http://codereview.chromium.org/9420028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125596 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppapi_command_buffer_proxy.h')
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h
new file mode 100644
index 0000000..2d66c14
--- /dev/null
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_
+#define PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_
+#pragma once
+
+#include "base/hash_tables.h"
+#include "gpu/command_buffer/common/command_buffer.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/host_resource.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+namespace proxy {
+
+class ProxyChannel;
+
+class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer {
+ public:
+ PpapiCommandBufferProxy(const HostResource& resource,
+ ProxyChannel* channel);
+ virtual ~PpapiCommandBufferProxy();
+
+ // gpu::CommandBuffer implementation:
+ virtual bool Initialize();
+ virtual State GetState();
+ virtual State GetLastState();
+ virtual void Flush(int32 put_offset);
+ virtual State FlushSync(int32 put_offset, int32 last_known_get);
+ virtual void SetGetBuffer(int32 transfer_buffer_id);
+ virtual void SetGetOffset(int32 get_offset);
+ virtual int32 CreateTransferBuffer(size_t size, int32 id_request);
+ virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory,
+ size_t size,
+ int32 id_request);
+ virtual void DestroyTransferBuffer(int32 id);
+ virtual gpu::Buffer GetTransferBuffer(int32 handle);
+ virtual void SetToken(int32 token);
+ virtual void SetParseError(gpu::error::Error error);
+ virtual void SetContextLostReason(gpu::error::ContextLostReason reason);
+
+ private:
+ bool Send(IPC::Message* msg);
+ void UpdateState(const gpu::CommandBuffer::State& state);
+
+ typedef base::hash_map<int32, gpu::Buffer> TransferBufferMap;
+ TransferBufferMap transfer_buffers_;
+
+ State last_state_;
+
+ HostResource resource_;
+ ProxyChannel* channel_;
+
+ DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_