Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: content/renderer/gpu/mailbox_output_surface.h

Issue 2009443002: Revert of Consolidate OutputSurface constructors into GL vs Vulkan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/output/output_surface.h"
15 #include "cc/resources/resource_format.h" 14 #include "cc/resources/resource_format.h"
16 #include "cc/resources/transferable_resource.h" 15 #include "cc/resources/transferable_resource.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;
22 class GLFrameData;
23 } 21 }
24 22
25 namespace content { 23 namespace content {
26 class FrameSwapMessageQueue; 24 class FrameSwapMessageQueue;
27 25
28 // Implementation of CompositorOutputSurface that renders to textures which 26 // Implementation of CompositorOutputSurface that renders to textures which
29 // are sent to the browser through the mailbox extension. 27 // are sent to the browser through the mailbox extension.
30 // This class can be created only on the main thread, but then becomes pinned 28 // This class can be created only on the main thread, but then becomes pinned
31 // to a fixed thread when bindToClient is called. 29 // to a fixed thread when bindToClient is called.
32 class MailboxOutputSurface : public cc::OutputSurface { 30 class MailboxOutputSurface : public CompositorOutputSurface {
33 public: 31 public:
34 MailboxOutputSurface( 32 MailboxOutputSurface(
33 int32_t routing_id,
35 uint32_t output_surface_id, 34 uint32_t output_surface_id,
36 scoped_refptr<cc::ContextProvider> context_provider, 35 const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
37 scoped_refptr<cc::ContextProvider> worker_context_provider); 36 const scoped_refptr<ContextProviderCommandBuffer>&
37 worker_context_provider,
38 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue,
39 cc::ResourceFormat format);
38 ~MailboxOutputSurface() override; 40 ~MailboxOutputSurface() override;
39 41
40 // cc::OutputSurface implementation. 42 // cc::OutputSurface implementation.
41 bool BindToClient(cc::OutputSurfaceClient* client) override;
42 void DetachFromClient() override; 43 void DetachFromClient() override;
43 void EnsureBackbuffer() override; 44 void EnsureBackbuffer() override;
44 void DiscardBackbuffer() override; 45 void DiscardBackbuffer() override;
45 void Reshape(const gfx::Size& size, float scale_factor, bool alpha) override; 46 void Reshape(const gfx::Size& size, float scale_factor, bool alpha) override;
46 void BindFramebuffer() override; 47 void BindFramebuffer() override;
47 void SwapBuffers(cc::CompositorFrame* frame) override; 48 void SwapBuffers(cc::CompositorFrame* frame) override;
48 49
49 private: 50 private:
50 void ShortcutSwapAck(uint32_t output_surface_id, 51 // CompositorOutputSurface overrides.
51 std::unique_ptr<cc::GLFrameData> gl_frame_data); 52 void OnSwapAck(uint32_t output_surface_id,
52 void OnSwapAck(uint32_t output_surface_id, const cc::CompositorFrameAck& ack); 53 const cc::CompositorFrameAck& ack) override;
53 54
54 size_t GetNumAcksPending(); 55 size_t GetNumAcksPending();
55 56
56 struct TransferableFrame { 57 struct TransferableFrame {
57 TransferableFrame(); 58 TransferableFrame();
58 TransferableFrame(uint32_t texture_id, 59 TransferableFrame(uint32_t texture_id,
59 const gpu::Mailbox& mailbox, 60 const gpu::Mailbox& mailbox,
60 const gfx::Size size); 61 const gfx::Size size);
61 62
62 uint32_t texture_id; 63 uint32_t texture_id;
63 gpu::Mailbox mailbox; 64 gpu::Mailbox mailbox;
64 gpu::SyncToken sync_token; 65 gpu::SyncToken sync_token;
65 gfx::Size size; 66 gfx::Size size;
66 }; 67 };
67 68
68 const uint32_t output_surface_id_;
69
70 TransferableFrame current_backing_; 69 TransferableFrame current_backing_;
71 std::deque<TransferableFrame> pending_textures_; 70 std::deque<TransferableFrame> pending_textures_;
72 std::queue<TransferableFrame> returned_textures_; 71 std::queue<TransferableFrame> returned_textures_;
73 72
74 uint32_t fbo_; 73 uint32_t fbo_;
75 bool is_backbuffer_discarded_; 74 bool is_backbuffer_discarded_;
76 75 cc::ResourceFormat format_;
77 std::unique_ptr<cc::CompositorFrameAck> previous_frame_ack_;
78 base::WeakPtrFactory<MailboxOutputSurface> weak_ptrs_;
79 }; 76 };
80 77
81 } // namespace content 78 } // namespace content
82 79
83 #endif // CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ 80 #endif // CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « content/renderer/gpu/delegated_compositor_output_surface.cc ('k') | content/renderer/gpu/mailbox_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698