Fix auto-uninstall of legacy multi-install Chrome Frame.
[chromium-blink-merge.git] / content / renderer / gpu / mailbox_output_surface.h
blob2a8e278e90ad423f68eaab71c891309a6ea53f95
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.
5 #ifndef CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_
6 #define CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_
8 #include <queue>
10 #include "cc/resources/resource_format.h"
11 #include "cc/resources/transferable_resource.h"
12 #include "content/renderer/gpu/compositor_output_surface.h"
13 #include "ui/gfx/size.h"
15 namespace cc {
16 class CompositorFrameAck;
19 namespace content {
21 // Implementation of CompositorOutputSurface that renders to textures which
22 // are sent to the browser through the mailbox extension.
23 // This class can be created only on the main thread, but then becomes pinned
24 // to a fixed thread when bindToClient is called.
25 class MailboxOutputSurface : public CompositorOutputSurface {
26 public:
27 MailboxOutputSurface(
28 int32 routing_id,
29 uint32 output_surface_id,
30 const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
31 scoped_ptr<cc::SoftwareOutputDevice> software_device,
32 cc::ResourceFormat format);
33 virtual ~MailboxOutputSurface();
35 // cc::OutputSurface implementation.
36 virtual void EnsureBackbuffer() OVERRIDE;
37 virtual void DiscardBackbuffer() OVERRIDE;
38 virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE;
39 virtual void BindFramebuffer() OVERRIDE;
40 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE;
42 private:
43 // CompositorOutputSurface overrides.
44 virtual void OnSwapAck(uint32 output_surface_id,
45 const cc::CompositorFrameAck& ack) OVERRIDE;
47 size_t GetNumAcksPending();
49 struct TransferableFrame {
50 TransferableFrame() : texture_id(0), sync_point(0) {}
52 TransferableFrame(uint32 texture_id,
53 const gpu::Mailbox& mailbox,
54 const gfx::Size size)
55 : texture_id(texture_id), mailbox(mailbox), size(size), sync_point(0) {}
57 uint32 texture_id;
58 gpu::Mailbox mailbox;
59 gfx::Size size;
60 uint32 sync_point;
63 TransferableFrame current_backing_;
64 std::deque<TransferableFrame> pending_textures_;
65 std::queue<TransferableFrame> returned_textures_;
67 uint32 fbo_;
68 bool is_backbuffer_discarded_;
69 cc::ResourceFormat format_;
72 } // namespace content
74 #endif // CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_