summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/command_buffer_proxy.h
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-09 23:28:43 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-09 23:28:43 +0000
commitcd189bdbe4ad339765549b41530b59c51973d2cf (patch)
treeebb322b7c0004526cf77f0ac44df5734015e9cab /chrome/renderer/command_buffer_proxy.h
parentd1015f1c5bc276109b62280694ec180e62ae909f (diff)
downloadchromium_src-cd189bdbe4ad339765549b41530b59c51973d2cf.zip
chromium_src-cd189bdbe4ad339765549b41530b59c51973d2cf.tar.gz
chromium_src-cd189bdbe4ad339765549b41530b59c51973d2cf.tar.bz2
Implemented async flushes for Pepper 3D.
Added waitForProgress field to NPDeviceContext3D to select between a flush (that pushes more work to the GPU process and waits for at least some of it to have been completed) and getting the current state as quickly as possible. The previous method of checking to see if the put offset had advanced was incorrect. TEST=trybots BUG=none Review URL: http://codereview.chromium.org/561058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/command_buffer_proxy.h')
-rw-r--r--chrome/renderer/command_buffer_proxy.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/renderer/command_buffer_proxy.h b/chrome/renderer/command_buffer_proxy.h
index b7bed4e..a2fb9c4 100644
--- a/chrome/renderer/command_buffer_proxy.h
+++ b/chrome/renderer/command_buffer_proxy.h
@@ -8,11 +8,13 @@
#if defined(ENABLE_GPU)
#include <map>
+#include <queue>
#include "base/linked_ptr.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/shared_memory.h"
+#include "base/task.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_message.h"
@@ -22,6 +24,7 @@ class PluginChannelHost;
// Client side proxy that forwards messages synchronously to a
// CommandBufferStub.
class CommandBufferProxy : public gpu::CommandBuffer,
+ public IPC::Channel::Listener,
public IPC::Message::Sender {
public:
explicit CommandBufferProxy(
@@ -29,6 +32,10 @@ class CommandBufferProxy : public gpu::CommandBuffer,
int route_id);
virtual ~CommandBufferProxy();
+ // IPC::Channel::Listener implementation:
+ virtual void OnMessageReceived(const IPC::Message& message);
+ virtual void OnChannelError();
+
// IPC::Message::Sender implementation:
virtual bool Send(IPC::Message* msg);
@@ -48,7 +55,23 @@ class CommandBufferProxy : public gpu::CommandBuffer,
virtual void SetWindowSize(int32 width, int32 height);
#endif
+ // Get the last state received from the service without synchronizing.
+ State GetLastState() {
+ return last_state_;
+ }
+
+ // Get the state asynchronously. The task is posted when the state is
+ // updated. Takes ownership of the task object.
+ void AsyncGetState(Task* completion_task);
+
+ // Flush the command buffer asynchronously. The task is posted when the flush
+ // completes. Takes ownership of the task object.
+ void AsyncFlush(int32 put_offset, Task* completion_task);
+
private:
+ // Message handlers:
+ void OnUpdateState(gpu::CommandBuffer::State state);
+
// As with the service, the client takes ownership of the ring buffer.
int32 size_;
scoped_ptr<base::SharedMemory> ring_buffer_;
@@ -57,9 +80,16 @@ class CommandBufferProxy : public gpu::CommandBuffer,
typedef std::map<int32, gpu::Buffer> TransferBufferMap;
TransferBufferMap transfer_buffers_;
+ // The last cached state received from the service.
+ State last_state_;
+
scoped_refptr<PluginChannelHost> channel_;
int route_id_;
+ // Pending asynchronous flush callbacks.
+ typedef std::queue<linked_ptr<Task> > AsyncFlushTaskQueue;
+ AsyncFlushTaskQueue pending_async_flush_tasks_;
+
DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy);
};