| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 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 CHROME_PLUGIN_COMMAND_BUFFER_STUB_H_ | |
| 6 #define CHROME_PLUGIN_COMMAND_BUFFER_STUB_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #if defined(ENABLE_GPU) | |
| 10 | |
| 11 #include "app/surface/transport_dib.h" | |
| 12 #include "base/ref_counted.h" | |
| 13 #include "gpu/command_buffer/common/command_buffer.h" | |
| 14 #include "gpu/command_buffer/service/command_buffer_service.h" | |
| 15 #include "gpu/command_buffer/service/gpu_processor.h" | |
| 16 #include "ipc/ipc_channel.h" | |
| 17 #include "ipc/ipc_message.h" | |
| 18 #include "ui/gfx/native_widget_types.h" | |
| 19 | |
| 20 class PluginChannel; | |
| 21 | |
| 22 class CommandBufferService; | |
| 23 | |
| 24 class CommandBufferStub : public IPC::Channel::Listener, | |
| 25 public IPC::Message::Sender { | |
| 26 public: | |
| 27 CommandBufferStub(PluginChannel* channel, | |
| 28 int plugin_host_route_id, | |
| 29 gfx::PluginWindowHandle window); | |
| 30 | |
| 31 virtual ~CommandBufferStub(); | |
| 32 | |
| 33 // IPC::Channel::Listener implementation: | |
| 34 virtual bool OnMessageReceived(const IPC::Message& message); | |
| 35 virtual void OnChannelError(); | |
| 36 | |
| 37 // IPC::Message::Sender implementation: | |
| 38 virtual bool Send(IPC::Message* msg); | |
| 39 | |
| 40 int route_id() const { return route_id_; } | |
| 41 | |
| 42 // Notify the client that it must repaint due to the window becoming invalid | |
| 43 // or a lost context. | |
| 44 void NotifyRepaint(); | |
| 45 | |
| 46 private: | |
| 47 // Message handlers: | |
| 48 void OnInitialize(base::SharedMemoryHandle ring_buffer, | |
| 49 int32 size, | |
| 50 bool* result); | |
| 51 void OnGetState(gpu::CommandBuffer::State* state); | |
| 52 void OnAsyncGetState(); | |
| 53 void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state); | |
| 54 void OnAsyncFlush(int32 put_offset); | |
| 55 void OnCreateTransferBuffer(int32 size, int32* id); | |
| 56 void OnDestroyTransferBuffer(int32 id); | |
| 57 void OnGetTransferBuffer(int32 id, | |
| 58 base::SharedMemoryHandle* transfer_buffer, | |
| 59 uint32* size); | |
| 60 | |
| 61 // Destroy all owned objects. | |
| 62 void Destroy(); | |
| 63 | |
| 64 bool InitializePlatformSpecific(); | |
| 65 void DestroyPlatformSpecific(); | |
| 66 | |
| 67 #if defined(OS_MACOSX) | |
| 68 void OnSetWindowSize(const gfx::Size& size); | |
| 69 void SwapBuffersCallback(); | |
| 70 void AllocTransportDIB(const size_t size, TransportDIB::Handle* dib_handle); | |
| 71 void FreeTransportDIB(TransportDIB::Id dib_id); | |
| 72 #endif | |
| 73 | |
| 74 scoped_refptr<PluginChannel> channel_; | |
| 75 int plugin_host_route_id_; | |
| 76 gfx::PluginWindowHandle window_; | |
| 77 int route_id_; | |
| 78 scoped_ptr<gpu::CommandBufferService> command_buffer_; | |
| 79 scoped_ptr<gpu::GPUProcessor> processor_; | |
| 80 }; | |
| 81 | |
| 82 #endif // ENABLE_GPU | |
| 83 | |
| 84 #endif // CHROME_PLUGIN_COMMAND_BUFFER_STUB_H_ | |
| OLD | NEW |