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