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

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

Issue 2002303002: Consolidate OutputSurface constructors into GL vs Vulkan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: outputsurface-constructors: rebase-and-fixcrash 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"
14 #include "cc/resources/resource_format.h" 15 #include "cc/resources/resource_format.h"
15 #include "cc/resources/transferable_resource.h" 16 #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;
21 } 23 }
22 24
23 namespace content { 25 namespace content {
24 class FrameSwapMessageQueue; 26 class FrameSwapMessageQueue;
25 27
26 // Implementation of CompositorOutputSurface that renders to textures which 28 // Implementation of CompositorOutputSurface that renders to textures which
27 // are sent to the browser through the mailbox extension. 29 // are sent to the browser through the mailbox extension.
28 // This class can be created only on the main thread, but then becomes pinned 30 // This class can be created only on the main thread, but then becomes pinned
29 // to a fixed thread when bindToClient is called. 31 // to a fixed thread when bindToClient is called.
30 class MailboxOutputSurface : public CompositorOutputSurface { 32 class MailboxOutputSurface : public cc::OutputSurface {
31 public: 33 public:
32 MailboxOutputSurface( 34 MailboxOutputSurface(
33 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,
39 cc::ResourceFormat format);
40 ~MailboxOutputSurface() override; 38 ~MailboxOutputSurface() override;
41 39
42 // cc::OutputSurface implementation. 40 // cc::OutputSurface implementation.
41 bool BindToClient(cc::OutputSurfaceClient* client) override;
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
50 private: 49 private:
51 // CompositorOutputSurface overrides. 50 void ShortcutSwapAck(uint32_t output_surface_id,
52 void OnSwapAck(uint32_t output_surface_id, 51 std::unique_ptr<cc::GLFrameData> gl_frame_data);
53 const cc::CompositorFrameAck& ack) override; 52 void OnSwapAck(uint32_t output_surface_id, const cc::CompositorFrameAck& ack);
54 53
55 size_t GetNumAcksPending(); 54 size_t GetNumAcksPending();
56 55
57 struct TransferableFrame { 56 struct TransferableFrame {
58 TransferableFrame(); 57 TransferableFrame();
59 TransferableFrame(uint32_t texture_id, 58 TransferableFrame(uint32_t texture_id,
60 const gpu::Mailbox& mailbox, 59 const gpu::Mailbox& mailbox,
61 const gfx::Size size); 60 const gfx::Size size);
62 61
63 uint32_t texture_id; 62 uint32_t texture_id;
64 gpu::Mailbox mailbox; 63 gpu::Mailbox mailbox;
65 gpu::SyncToken sync_token; 64 gpu::SyncToken sync_token;
66 gfx::Size size; 65 gfx::Size size;
67 }; 66 };
68 67
68 const uint32_t output_surface_id_;
69
69 TransferableFrame current_backing_; 70 TransferableFrame current_backing_;
70 std::deque<TransferableFrame> pending_textures_; 71 std::deque<TransferableFrame> pending_textures_;
71 std::queue<TransferableFrame> returned_textures_; 72 std::queue<TransferableFrame> returned_textures_;
72 73
73 uint32_t fbo_; 74 uint32_t fbo_;
74 bool is_backbuffer_discarded_; 75 bool is_backbuffer_discarded_;
75 cc::ResourceFormat format_; 76
77 std::unique_ptr<cc::CompositorFrameAck> previous_frame_ack_;
78 base::WeakPtrFactory<MailboxOutputSurface> weak_ptrs_;
76 }; 79 };
77 80
78 } // namespace content 81 } // namespace content
79 82
80 #endif // CONTENT_RENDERER_GPU_MAILBOX_OUTPUT_SURFACE_H_ 83 #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