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

Side by Side Diff: content/renderer/pepper/ppb_graphics_3d_impl.h

Issue 1912833002: Pepper takes ownership of a mailbox before passing it to the texture layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from piman. 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_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ 6 #define CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 30 matching lines...) Expand all
41 PP_Bool SetGetBuffer(int32_t transfer_buffer_id) override; 41 PP_Bool SetGetBuffer(int32_t transfer_buffer_id) override;
42 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, 42 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size,
43 int32_t* id) override; 43 int32_t* id) override;
44 PP_Bool DestroyTransferBuffer(int32_t id) override; 44 PP_Bool DestroyTransferBuffer(int32_t id) override;
45 PP_Bool Flush(int32_t put_offset) override; 45 PP_Bool Flush(int32_t put_offset) override;
46 gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, 46 gpu::CommandBuffer::State WaitForTokenInRange(int32_t start,
47 int32_t end) override; 47 int32_t end) override;
48 gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, 48 gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start,
49 int32_t end) override; 49 int32_t end) override;
50 void EnsureWorkVisible() override; 50 void EnsureWorkVisible() override;
51 void TakeFrontBuffer() override;
51 52
52 // Binds/unbinds the graphics of this context with the associated instance. 53 // Binds/unbinds the graphics of this context with the associated instance.
53 // Returns true if binding/unbinding is successful. 54 // Returns true if binding/unbinding is successful.
54 bool BindToInstance(bool bind); 55 bool BindToInstance(bool bind);
55 56
56 // Returns true if the backing texture is always opaque. 57 // Returns true if the backing texture is always opaque.
57 bool IsOpaque(); 58 bool IsOpaque();
58 59
59 // Notifications about the view's progress painting. See PluginInstance. 60 // Notifications about the view's progress painting. See PluginInstance.
60 // These messages are used to send Flush callbacks to the plugin. 61 // These messages are used to send Flush callbacks to the plugin.
61 void ViewInitiatedPaint(); 62 void ViewInitiatedPaint();
62 63
63 void GetBackingMailbox(gpu::Mailbox* mailbox, gpu::SyncToken* sync_token) {
64 *mailbox = mailbox_;
65 *sync_token = sync_token_;
66 }
67
68 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); 64 gpu::CommandBufferProxyImpl* GetCommandBufferProxy();
69 65
70 gpu::GpuChannelHost* channel() { return channel_.get(); } 66 gpu::GpuChannelHost* channel() { return channel_.get(); }
71 67
72 protected: 68 protected:
73 ~PPB_Graphics3D_Impl() override; 69 ~PPB_Graphics3D_Impl() override;
74 // ppapi::PPB_Graphics3D_Shared overrides. 70 // ppapi::PPB_Graphics3D_Shared overrides.
75 gpu::CommandBuffer* GetCommandBuffer() override; 71 gpu::CommandBuffer* GetCommandBuffer() override;
76 gpu::GpuControl* GetGpuControl() override; 72 gpu::GpuControl* GetGpuControl() override;
77 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override; 73 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override;
78 74
79 private: 75 private:
80 explicit PPB_Graphics3D_Impl(PP_Instance instance); 76 explicit PPB_Graphics3D_Impl(PP_Instance instance);
81 77
82 bool InitRaw(PPB_Graphics3D_API* share_context, 78 bool InitRaw(PPB_Graphics3D_API* share_context,
83 const int32_t* attrib_list, 79 const int32_t* attrib_list,
84 gpu::Capabilities* capabilities, 80 gpu::Capabilities* capabilities,
85 base::SharedMemoryHandle* shared_state_handle, 81 base::SharedMemoryHandle* shared_state_handle,
86 gpu::CommandBufferId* command_buffer_id); 82 gpu::CommandBufferId* command_buffer_id);
87 83
88 // GpuControlClient implementation. 84 // GpuControlClient implementation.
89 void OnGpuControlLostContext() final; 85 void OnGpuControlLostContext() final;
90 void OnGpuControlErrorMessage(const char* msg, int id) final; 86 void OnGpuControlErrorMessage(const char* msg, int id) final;
91 87
92 // Other notifications from the GPU process. 88 // Other notifications from the GPU process.
93 void OnSwapBuffers(); 89 void OnSwapBuffers();
94 // Notifications sent to plugin. 90 // Notifications sent to plugin.
95 void SendContextLost(); 91 void SendContextLost();
96 92
93 // A front buffer that was recently taken from the command buffer. This should
94 // be immediately consumed by DoSwapBuffers().
95 gpu::Mailbox taken_front_buffer_;
96
97 // Mailboxes that are no longer in use.
98 std::vector<gpu::Mailbox> mailboxes_to_reuse_;
99
97 // True if context is bound to instance. 100 // True if context is bound to instance.
98 bool bound_to_instance_; 101 bool bound_to_instance_;
99 // True when waiting for compositor to commit our backing texture. 102 // True when waiting for compositor to commit our backing texture.
100 bool commit_pending_; 103 bool commit_pending_;
101 104
102 #if DCHECK_IS_ON() 105 #if DCHECK_IS_ON()
103 bool lost_context_ = false; 106 bool lost_context_ = false;
104 #endif 107 #endif
105 108
106 gpu::Mailbox mailbox_;
107 gpu::SyncToken sync_token_;
108 bool has_alpha_; 109 bool has_alpha_;
109 scoped_refptr<gpu::GpuChannelHost> channel_; 110 scoped_refptr<gpu::GpuChannelHost> channel_;
110 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; 111 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_;
111 112
112 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; 113 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_;
113 114
114 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); 115 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl);
115 }; 116 };
116 117
117 } // namespace content 118 } // namespace content
118 119
119 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ 120 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698