| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ | 5 #ifndef CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ |
| 6 #define CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ | 6 #define CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <queue> | 11 #include <queue> |
| 12 | 12 |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "cc/resources/resource_format.h" | 14 #include "cc/resources/resource_format.h" |
| 15 #include "cc/resources/transferable_resource.h" | 15 #include "cc/resources/transferable_resource.h" |
| 16 #include "content/renderer/gpu/compositor_output_surface.h" | 16 #include "content/renderer/gpu/compositor_output_surface.h" |
| 17 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 class CompositorFrameAck; | 20 class CompositorFrameAck; |
| 21 class ContextProvider; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 class FrameSwapMessageQueue; | 25 class FrameSwapMessageQueue; |
| 25 | 26 |
| 26 // Implementation of CompositorOutputSurface that renders to textures which | 27 // Implementation of CompositorOutputSurface that renders to textures which |
| 27 // are sent to the browser through the mailbox extension. | 28 // are sent to the browser through the mailbox extension. |
| 28 // This class can be created only on the main thread, but then becomes pinned | 29 // This class can be created only on the main thread, but then becomes pinned |
| 29 // to a fixed thread when bindToClient is called. | 30 // to a fixed thread when bindToClient is called. |
| 30 class MailboxOutputSurface : public CompositorOutputSurface { | 31 class MailboxOutputSurface : public CompositorOutputSurface { |
| 31 public: | 32 public: |
| 32 MailboxOutputSurface( | 33 MailboxOutputSurface( |
| 33 int32_t routing_id, | 34 int32_t routing_id, |
| 34 uint32_t output_surface_id, | 35 uint32_t output_surface_id, |
| 35 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 36 scoped_refptr<cc::ContextProvider> context_provider, |
| 36 const scoped_refptr<ContextProviderCommandBuffer>& | 37 scoped_refptr<cc::ContextProvider> worker_context_provider, |
| 37 worker_context_provider, | 38 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue); |
| 38 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue, | |
| 39 cc::ResourceFormat format); | |
| 40 ~MailboxOutputSurface() override; | 39 ~MailboxOutputSurface() override; |
| 41 | 40 |
| 42 // cc::OutputSurface implementation. | 41 // cc::OutputSurface implementation. |
| 43 void DetachFromClient() override; | 42 void DetachFromClient() override; |
| 44 void EnsureBackbuffer() override; | 43 void EnsureBackbuffer() override; |
| 45 void DiscardBackbuffer() override; | 44 void DiscardBackbuffer() override; |
| 46 void Reshape(const gfx::Size& size, float scale_factor, bool alpha) override; | 45 void Reshape(const gfx::Size& size, float scale_factor, bool alpha) override; |
| 47 void BindFramebuffer() override; | 46 void BindFramebuffer() override; |
| 48 void SwapBuffers(cc::CompositorFrame* frame) override; | 47 void SwapBuffers(cc::CompositorFrame* frame) override; |
| 49 | 48 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 65 gpu::SyncToken sync_token; | 64 gpu::SyncToken sync_token; |
| 66 gfx::Size size; | 65 gfx::Size size; |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 TransferableFrame current_backing_; | 68 TransferableFrame current_backing_; |
| 70 std::deque<TransferableFrame> pending_textures_; | 69 std::deque<TransferableFrame> pending_textures_; |
| 71 std::queue<TransferableFrame> returned_textures_; | 70 std::queue<TransferableFrame> returned_textures_; |
| 72 | 71 |
| 73 uint32_t fbo_; | 72 uint32_t fbo_; |
| 74 bool is_backbuffer_discarded_; | 73 bool is_backbuffer_discarded_; |
| 75 cc::ResourceFormat format_; | |
| 76 }; | 74 }; |
| 77 | 75 |
| 78 } // namespace content | 76 } // namespace content |
| 79 | 77 |
| 80 #endif // CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ | 78 #endif // CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ |
| OLD | NEW |