OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ |
| 6 #define CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ |
| 7 |
| 8 #include <queue> |
| 9 |
| 10 #include "cc/transferable_resource.h" |
| 11 #include "content/renderer/gpu/compositor_output_surface.h" |
| 12 #include "ui/gfx/size.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 // Implementation of CompositorOutputSurface that renders to textures which |
| 17 // are sent to the browser through the mailbox extension. |
| 18 // This class can be created only on the main thread, but then becomes pinned |
| 19 // to a fixed thread when bindToClient is called. |
| 20 class MailboxOutputSurface : public CompositorOutputSurface { |
| 21 public: |
| 22 MailboxOutputSurface(int32 routing_id, |
| 23 WebKit::WebGraphicsContext3D* context3d, |
| 24 cc::SoftwareOutputDevice* software); |
| 25 virtual ~MailboxOutputSurface(); |
| 26 |
| 27 // cc::OutputSurface implementation. |
| 28 virtual void SendFrameToParentCompositor(cc::CompositorFrame* frame) OVERRIDE; |
| 29 virtual void EnsureBackbuffer() OVERRIDE; |
| 30 virtual void DiscardBackbuffer() OVERRIDE; |
| 31 virtual void Reshape(const gfx::Size& size) OVERRIDE; |
| 32 virtual void BindFramebuffer() OVERRIDE; |
| 33 virtual void PostSubBuffer(const gfx::Rect& rect) OVERRIDE; |
| 34 virtual void SwapBuffers() OVERRIDE; |
| 35 |
| 36 private: |
| 37 // CompositorOutputSurface overrides. |
| 38 virtual void OnSwapAck(const cc::CompositorFrameAck& ack) OVERRIDE; |
| 39 |
| 40 struct TransferableFrame |
| 41 { |
| 42 TransferableFrame() |
| 43 : texture_id(0) {} |
| 44 |
| 45 TransferableFrame(uint32 texture_id, |
| 46 const cc::Mailbox& mailbox, |
| 47 const gfx::Size& size) |
| 48 : texture_id(texture_id), |
| 49 mailbox(mailbox), |
| 50 size(size) {} |
| 51 |
| 52 uint32 texture_id; |
| 53 cc::Mailbox mailbox; |
| 54 gfx::Size size; |
| 55 }; |
| 56 TransferableFrame current_backing_; |
| 57 std::queue<TransferableFrame> returned_textures_; |
| 58 |
| 59 gfx::Size size_; |
| 60 uint32 fbo_; |
| 61 }; |
| 62 |
| 63 } // namespace content |
| 64 |
| 65 #endif // CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ |
OLD | NEW |