diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-05 21:53:50 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-05 21:53:50 +0000 |
commit | 246a7045b9c45620fd725210aac51322e611c83f (patch) | |
tree | 6bdce605ae758c282a2b27e92a6b223d98b8d46a /chrome/gpu/gpu_command_buffer_stub.h | |
parent | c3240722a63ff142684575e3ea4eb89915edae72 (diff) | |
download | chromium_src-246a7045b9c45620fd725210aac51322e611c83f.zip chromium_src-246a7045b9c45620fd725210aac51322e611c83f.tar.gz chromium_src-246a7045b9c45620fd725210aac51322e611c83f.tar.bz2 |
Added support for opening a GPU command buffer from a renderer processes through a GPU channel.
Probably only works in windows only so far.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/657046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/gpu/gpu_command_buffer_stub.h')
-rw-r--r-- | chrome/gpu/gpu_command_buffer_stub.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/chrome/gpu/gpu_command_buffer_stub.h b/chrome/gpu/gpu_command_buffer_stub.h new file mode 100644 index 0000000..f1446e8 --- /dev/null +++ b/chrome/gpu/gpu_command_buffer_stub.h @@ -0,0 +1,62 @@ +// Copyright (c) 2010 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 CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ +#define CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ + +#if defined(ENABLE_GPU) + +#include "app/gfx/native_widget_types.h" +#include "base/process.h" +#include "base/ref_counted.h" +#include "gpu/command_buffer/service/command_buffer_service.h" +#include "gpu/command_buffer/service/gpu_processor.h" +#include "ipc/ipc_channel.h" +#include "ipc/ipc_message.h" + +class GpuChannel; + +class GpuCommandBufferStub + : public IPC::Channel::Listener, + public IPC::Message::Sender, + public base::RefCountedThreadSafe<GpuCommandBufferStub> { + public: + GpuCommandBufferStub(GpuChannel* channel, + int32 route_id); + + virtual ~GpuCommandBufferStub(); + + // IPC::Channel::Listener implementation: + virtual void OnMessageReceived(const IPC::Message& message); + + // IPC::Message::Sender implementation: + virtual bool Send(IPC::Message* msg); + + int route_id() const { return route_id_; } + + private: + // Message handlers: + void OnInitialize(int32 size, base::SharedMemoryHandle* ring_buffer); + void OnGetState(gpu::CommandBuffer::State* state); + void OnAsyncGetState(); + void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state); + void OnAsyncFlush(int32 put_offset); + void OnCreateTransferBuffer(int32 size, int32* id); + void OnDestroyTransferBuffer(int32 id); + void OnGetTransferBuffer(int32 id, + base::SharedMemoryHandle* transfer_buffer, + uint32* size); + + scoped_refptr<GpuChannel> channel_; + int route_id_; + + scoped_ptr<gpu::CommandBufferService> command_buffer_; + scoped_refptr<gpu::GPUProcessor> processor_; + + DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); +}; + +#endif // ENABLE_GPU + +#endif // CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ |