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

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 bbudge. 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;
52 void ReturnFrontBuffer(const gpu::Mailbox& mailbox,
53 const gpu::SyncToken& sync_token,
54 bool is_lost);
51 55
52 // Binds/unbinds the graphics of this context with the associated instance. 56 // Binds/unbinds the graphics of this context with the associated instance.
53 // Returns true if binding/unbinding is successful. 57 // Returns true if binding/unbinding is successful.
54 bool BindToInstance(bool bind); 58 bool BindToInstance(bool bind);
55 59
56 // Returns true if the backing texture is always opaque. 60 // Returns true if the backing texture is always opaque.
57 bool IsOpaque(); 61 bool IsOpaque();
58 62
59 // Notifications about the view's progress painting. See PluginInstance. 63 // Notifications about the view's progress painting. See PluginInstance.
60 // These messages are used to send Flush callbacks to the plugin. 64 // These messages are used to send Flush callbacks to the plugin.
61 void ViewInitiatedPaint(); 65 void ViewInitiatedPaint();
62 66
63 void GetBackingMailbox(gpu::Mailbox* mailbox, gpu::SyncToken* sync_token) {
64 *mailbox = mailbox_;
65 *sync_token = sync_token_;
66 }
67
68 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); 67 gpu::CommandBufferProxyImpl* GetCommandBufferProxy();
69 68
70 gpu::GpuChannelHost* channel() { return channel_.get(); } 69 gpu::GpuChannelHost* channel() { return channel_.get(); }
71 70
72 protected: 71 protected:
73 ~PPB_Graphics3D_Impl() override; 72 ~PPB_Graphics3D_Impl() override;
74 // ppapi::PPB_Graphics3D_Shared overrides. 73 // ppapi::PPB_Graphics3D_Shared overrides.
75 gpu::CommandBuffer* GetCommandBuffer() override; 74 gpu::CommandBuffer* GetCommandBuffer() override;
76 gpu::GpuControl* GetGpuControl() override; 75 gpu::GpuControl* GetGpuControl() override;
77 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override; 76 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override;
78 77
79 private: 78 private:
80 explicit PPB_Graphics3D_Impl(PP_Instance instance); 79 explicit PPB_Graphics3D_Impl(PP_Instance instance);
81 80
82 bool InitRaw(PPB_Graphics3D_API* share_context, 81 bool InitRaw(PPB_Graphics3D_API* share_context,
83 const int32_t* attrib_list, 82 const int32_t* attrib_list,
84 gpu::Capabilities* capabilities, 83 gpu::Capabilities* capabilities,
85 base::SharedMemoryHandle* shared_state_handle, 84 base::SharedMemoryHandle* shared_state_handle,
86 gpu::CommandBufferId* command_buffer_id); 85 gpu::CommandBufferId* command_buffer_id);
87 86
88 // GpuControlClient implementation. 87 // GpuControlClient implementation.
89 void OnGpuControlLostContext() final; 88 void OnGpuControlLostContext() final;
90 void OnGpuControlErrorMessage(const char* msg, int id) final; 89 void OnGpuControlErrorMessage(const char* msg, int id) final;
91 90
92 // Other notifications from the GPU process. 91 // Other notifications from the GPU process.
93 void OnSwapBuffers(); 92 void OnSwapBuffers();
94 // Notifications sent to plugin. 93 // Notifications sent to plugin.
95 void SendContextLost(); 94 void SendContextLost();
96 95
96 // Reuses a mailbox if one is available, otherwise makes a new one.
97 gpu::Mailbox GenerateMailbox();
98
99 // A front buffer that was recently taken from the command buffer. This should
100 // be immediately consumed by DoSwapBuffers().
101 gpu::Mailbox taken_front_buffer_;
102
103 // Mailboxes that are no longer in use.
104 std::vector<gpu::Mailbox> mailboxes_to_reuse_;
105
97 // True if context is bound to instance. 106 // True if context is bound to instance.
98 bool bound_to_instance_; 107 bool bound_to_instance_;
99 // True when waiting for compositor to commit our backing texture. 108 // True when waiting for compositor to commit our backing texture.
100 bool commit_pending_; 109 bool commit_pending_;
101 110
102 #if DCHECK_IS_ON() 111 #if DCHECK_IS_ON()
103 bool lost_context_ = false; 112 bool lost_context_ = false;
104 #endif 113 #endif
105 114
106 gpu::Mailbox mailbox_;
107 gpu::SyncToken sync_token_;
108 bool has_alpha_; 115 bool has_alpha_;
109 scoped_refptr<gpu::GpuChannelHost> channel_; 116 scoped_refptr<gpu::GpuChannelHost> channel_;
110 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; 117 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_;
111 118
112 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; 119 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_;
113 120
114 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); 121 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl);
115 }; 122 };
116 123
117 } // namespace content 124 } // namespace content
118 125
119 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ 126 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.cc ('k') | content/renderer/pepper/ppb_graphics_3d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698