| OLD | NEW |
| 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 #include "content/renderer/gpu/compositor_output_surface.h" | 5 #include "content/renderer/gpu/compositor_output_surface.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| 31 CompositorOutputSurface::CompositorOutputSurface( | 31 CompositorOutputSurface::CompositorOutputSurface( |
| 32 int32_t routing_id, | 32 int32_t routing_id, |
| 33 uint32_t output_surface_id, | 33 uint32_t output_surface_id, |
| 34 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 34 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
| 35 const scoped_refptr<ContextProviderCommandBuffer>& worker_context_provider, | 35 const scoped_refptr<ContextProviderCommandBuffer>& worker_context_provider, |
| 36 #if defined(ENABLE_VULKAN) | 36 #if defined(ENABLE_VULKAN) |
| 37 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, | 37 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, |
| 38 #endif | 38 #endif |
| 39 scoped_ptr<cc::SoftwareOutputDevice> software_device, | 39 std::unique_ptr<cc::SoftwareOutputDevice> software_device, |
| 40 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue, | 40 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue, |
| 41 bool use_swap_compositor_frame_message) | 41 bool use_swap_compositor_frame_message) |
| 42 : OutputSurface(context_provider, | 42 : OutputSurface(context_provider, |
| 43 worker_context_provider, | 43 worker_context_provider, |
| 44 #if defined(ENABLE_VULKAN) | 44 #if defined(ENABLE_VULKAN) |
| 45 vulkan_context_provider, | 45 vulkan_context_provider, |
| 46 #endif | 46 #endif |
| 47 std::move(software_device)), | 47 std::move(software_device)), |
| 48 output_surface_id_(output_surface_id), | 48 output_surface_id_(output_surface_id), |
| 49 use_swap_compositor_frame_message_(use_swap_compositor_frame_message), | 49 use_swap_compositor_frame_message_(use_swap_compositor_frame_message), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return; | 90 return; |
| 91 if (output_surface_proxy_.get()) | 91 if (output_surface_proxy_.get()) |
| 92 output_surface_proxy_->ClearOutputSurface(); | 92 output_surface_proxy_->ClearOutputSurface(); |
| 93 output_surface_filter_->RemoveHandlerOnCompositorThread( | 93 output_surface_filter_->RemoveHandlerOnCompositorThread( |
| 94 routing_id_, output_surface_filter_handler_); | 94 routing_id_, output_surface_filter_handler_); |
| 95 cc::OutputSurface::DetachFromClient(); | 95 cc::OutputSurface::DetachFromClient(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void CompositorOutputSurface::ShortcutSwapAck( | 98 void CompositorOutputSurface::ShortcutSwapAck( |
| 99 uint32_t output_surface_id, | 99 uint32_t output_surface_id, |
| 100 scoped_ptr<cc::GLFrameData> gl_frame_data) { | 100 std::unique_ptr<cc::GLFrameData> gl_frame_data) { |
| 101 if (!layout_test_previous_frame_ack_) { | 101 if (!layout_test_previous_frame_ack_) { |
| 102 layout_test_previous_frame_ack_.reset(new cc::CompositorFrameAck); | 102 layout_test_previous_frame_ack_.reset(new cc::CompositorFrameAck); |
| 103 layout_test_previous_frame_ack_->gl_frame_data.reset(new cc::GLFrameData); | 103 layout_test_previous_frame_ack_->gl_frame_data.reset(new cc::GLFrameData); |
| 104 } | 104 } |
| 105 | 105 |
| 106 OnSwapAck(output_surface_id, *layout_test_previous_frame_ack_); | 106 OnSwapAck(output_surface_id, *layout_test_previous_frame_ack_); |
| 107 | 107 |
| 108 layout_test_previous_frame_ack_->gl_frame_data = std::move(gl_frame_data); | 108 layout_test_previous_frame_ack_->gl_frame_data = std::move(gl_frame_data); |
| 109 } | 109 } |
| 110 | 110 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 136 | 136 |
| 137 context_provider()->ContextSupport()->SignalSyncToken(sync_token, | 137 context_provider()->ContextSupport()->SignalSyncToken(sync_token, |
| 138 closure); | 138 closure); |
| 139 } else { | 139 } else { |
| 140 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, closure); | 140 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, closure); |
| 141 } | 141 } |
| 142 client_->DidSwapBuffers(); | 142 client_->DidSwapBuffers(); |
| 143 return; | 143 return; |
| 144 } else { | 144 } else { |
| 145 { | 145 { |
| 146 std::vector<scoped_ptr<IPC::Message>> messages; | 146 std::vector<std::unique_ptr<IPC::Message>> messages; |
| 147 std::vector<IPC::Message> messages_to_deliver_with_frame; | 147 std::vector<IPC::Message> messages_to_deliver_with_frame; |
| 148 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope = | 148 std::unique_ptr<FrameSwapMessageQueue::SendMessageScope> |
| 149 frame_swap_message_queue_->AcquireSendMessageScope(); | 149 send_message_scope = |
| 150 frame_swap_message_queue_->AcquireSendMessageScope(); |
| 150 frame_swap_message_queue_->DrainMessages(&messages); | 151 frame_swap_message_queue_->DrainMessages(&messages); |
| 151 FrameSwapMessageQueue::TransferMessages(&messages, | 152 FrameSwapMessageQueue::TransferMessages(&messages, |
| 152 &messages_to_deliver_with_frame); | 153 &messages_to_deliver_with_frame); |
| 153 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, | 154 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, |
| 154 output_surface_id_, | 155 output_surface_id_, |
| 155 *frame, | 156 *frame, |
| 156 messages_to_deliver_with_frame)); | 157 messages_to_deliver_with_frame)); |
| 157 // ~send_message_scope. | 158 // ~send_message_scope. |
| 158 } | 159 } |
| 159 client_->DidSwapBuffers(); | 160 client_->DidSwapBuffers(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 if (output_surface_id != output_surface_id_) | 198 if (output_surface_id != output_surface_id_) |
| 198 return; | 199 return; |
| 199 ReclaimResources(&ack); | 200 ReclaimResources(&ack); |
| 200 } | 201 } |
| 201 | 202 |
| 202 bool CompositorOutputSurface::Send(IPC::Message* message) { | 203 bool CompositorOutputSurface::Send(IPC::Message* message) { |
| 203 return message_sender_->Send(message); | 204 return message_sender_->Send(message); |
| 204 } | 205 } |
| 205 | 206 |
| 206 } // namespace content | 207 } // namespace content |
| OLD | NEW |