Chromium Code Reviews| Index: content/renderer/gpu/mailbox_output_surface.h |
| diff --git a/content/renderer/gpu/mailbox_output_surface.h b/content/renderer/gpu/mailbox_output_surface.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..617200d429473d2ea397a7738d8b4df1b0593452 |
| --- /dev/null |
| +++ b/content/renderer/gpu/mailbox_output_surface.h |
| @@ -0,0 +1,69 @@ |
| +// Copyright (c) 2012 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 CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ |
| +#define CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ |
| + |
| +#include <queue> |
| + |
| +#include "cc/transferable_resource.h" |
| +#include "content/renderer/gpu/compositor_output_surface.h" |
| +#include "ui/gfx/size.h" |
| + |
| +namespace cc { |
| +class CompositorFrameAck; |
| +} |
| + |
| +namespace content { |
| + |
| +// Implementation of CompositorOutputSurface that renders to textures which |
| +// are sent to the browser through the mailbox extension. |
| +// This class can be created only on the main thread, but then becomes pinned |
| +// to a fixed thread when bindToClient is called. |
| +class MailboxOutputSurface : public CompositorOutputSurface { |
| + public: |
| + MailboxOutputSurface(int32 routing_id, |
| + WebKit::WebGraphicsContext3D* context3d, |
| + cc::SoftwareOutputDevice* software); |
| + virtual ~MailboxOutputSurface(); |
| + |
| + // cc::OutputSurface implementation. |
| + virtual void SendFrameToParentCompositor(cc::CompositorFrame* frame) OVERRIDE; |
| + virtual void EnsureBackbuffer() OVERRIDE; |
| + virtual void DiscardBackbuffer() OVERRIDE; |
| + virtual void Reshape(const gfx::Size& size) OVERRIDE; |
| + virtual void BindFramebuffer() OVERRIDE; |
| + virtual void PostSubBuffer(const gfx::Rect& rect) OVERRIDE; |
| + virtual void SwapBuffers() OVERRIDE; |
| + |
| + private: |
| + // CompositorOutputSurface overrides. |
| + virtual void OnSwapAck(const cc::CompositorFrameAck& ack) OVERRIDE; |
| + |
| + struct TransferableFrame |
| + { |
| + TransferableFrame() |
| + : texture_id(0) {} |
| + |
| + TransferableFrame(uint32 texture_id, |
| + const cc::Mailbox& mailbox, |
| + const gfx::Size& size) |
|
Sami
2013/02/28 12:46:58
Nit: pass by value.
no sievers
2013/02/28 18:43:40
Done.
|
| + : texture_id(texture_id), |
| + mailbox(mailbox), |
| + size(size) {} |
| + |
| + uint32 texture_id; |
| + cc::Mailbox mailbox; |
| + gfx::Size size; |
| + }; |
| + TransferableFrame current_backing_; |
| + std::queue<TransferableFrame> returned_textures_; |
| + |
| + gfx::Size size_; |
| + uint32 fbo_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ |