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

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

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