OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_LINUX_H_ |
| 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_LINUX_H_ |
| 7 #pragma once |
| 8 |
| 9 #if defined(ENABLE_GPU) |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "ipc/ipc_channel.h" |
| 13 #include "ipc/ipc_message.h" |
| 14 #include "ui/gfx/size.h" |
| 15 |
| 16 class GpuCommandBufferStub; |
| 17 |
| 18 namespace gfx { |
| 19 class GLSurface; |
| 20 } |
| 21 |
| 22 namespace gpu { |
| 23 class GpuScheduler; |
| 24 } |
| 25 |
| 26 class ImageTransportSurface : public IPC::Channel::Listener, |
| 27 public IPC::Message::Sender { |
| 28 public: |
| 29 // Creates the appropriate surface depending on the GL implementation |
| 30 static scoped_refptr<gfx::GLSurface> |
| 31 CreateSurface(GpuCommandBufferStub* stub); |
| 32 |
| 33 bool Initialize(); |
| 34 void Destroy(); |
| 35 |
| 36 // IPC::Channel::Listener implementation: |
| 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 38 |
| 39 // IPC::Message::Sender implementation: |
| 40 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 41 |
| 42 protected: |
| 43 explicit ImageTransportSurface(GpuCommandBufferStub* stub); |
| 44 ~ImageTransportSurface(); |
| 45 |
| 46 // IPC::Message handlers |
| 47 virtual void OnSetSurfaceACK(uint64 surface_id) = 0; |
| 48 virtual void OnBuffersSwappedACK() = 0; |
| 49 |
| 50 // Resize the backbuffer |
| 51 virtual void Resize(gfx::Size size) = 0; |
| 52 |
| 53 GpuCommandBufferStub* stub() { return stub_; } |
| 54 gpu::GpuScheduler* scheduler(); |
| 55 int32 route_id() { return route_id_; } |
| 56 |
| 57 private: |
| 58 // Weak pointer. The stub outlives this surface. |
| 59 GpuCommandBufferStub* stub_; |
| 60 int32 route_id_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); |
| 63 }; |
| 64 |
| 65 #endif // defined(ENABLE_GPU) |
| 66 |
| 67 #endif // CONTENT_COMMON_GPU_EGL_IMAGE_TRANSPORT_SURFACE_LINUX_H_ |
OLD | NEW |