| 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 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
| 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" | 22 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" |
| 23 #include "ipc/ipc_sync_message_filter.h" | 23 #include "ipc/ipc_sync_message_filter.h" |
| 24 | 24 |
| 25 namespace IPC { | 25 namespace IPC { |
| 26 class Message; | 26 class Message; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace cc { | 29 namespace cc { |
| 30 class CompositorFrame; | 30 class CompositorFrame; |
| 31 class CompositorFrameAck; | 31 class CompositorFrameAck; |
| 32 class ContextProvider; |
| 32 class GLFrameData; | 33 class GLFrameData; |
| 33 } | 34 } |
| 34 | 35 |
| 35 namespace content { | 36 namespace content { |
| 36 class ContextProviderCommandBuffer; | |
| 37 class FrameSwapMessageQueue; | 37 class FrameSwapMessageQueue; |
| 38 | 38 |
| 39 // This class can be created only on the main thread, but then becomes pinned | 39 // This class can be created only on the main thread, but then becomes pinned |
| 40 // to a fixed thread when bindToClient is called. | 40 // to a fixed thread when BindToClient is called. |
| 41 class CompositorOutputSurface | 41 class CompositorOutputSurface |
| 42 : NON_EXPORTED_BASE(public cc::OutputSurface), | 42 : NON_EXPORTED_BASE(public cc::OutputSurface), |
| 43 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 43 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 44 public: | 44 public: |
| 45 CompositorOutputSurface( | 45 CompositorOutputSurface( |
| 46 int32_t routing_id, | 46 int32_t routing_id, |
| 47 uint32_t output_surface_id, | 47 uint32_t output_surface_id, |
| 48 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 48 scoped_refptr<cc::ContextProvider> context_provider, |
| 49 const scoped_refptr<ContextProviderCommandBuffer>& | 49 scoped_refptr<cc::ContextProvider> worker_context_provider, |
| 50 worker_context_provider, | 50 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue); |
| 51 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, | 51 CompositorOutputSurface( |
| 52 std::unique_ptr<cc::SoftwareOutputDevice> software, | 52 int32_t routing_id, |
| 53 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue, | 53 uint32_t output_surface_id, |
| 54 bool use_swap_compositor_frame_message); | 54 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, |
| 55 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue); |
| 55 ~CompositorOutputSurface() override; | 56 ~CompositorOutputSurface() override; |
| 56 | 57 |
| 57 // cc::OutputSurface implementation. | 58 // cc::OutputSurface implementation. |
| 58 bool BindToClient(cc::OutputSurfaceClient* client) override; | 59 bool BindToClient(cc::OutputSurfaceClient* client) override; |
| 59 void DetachFromClient() override; | 60 void DetachFromClient() override; |
| 60 void SwapBuffers(cc::CompositorFrame* frame) override; | 61 void SwapBuffers(cc::CompositorFrame* frame) override; |
| 61 | 62 |
| 62 protected: | 63 protected: |
| 63 void ShortcutSwapAck(uint32_t output_surface_id, | 64 void ShortcutSwapAck(uint32_t output_surface_id, |
| 64 std::unique_ptr<cc::GLFrameData> gl_frame_data); | 65 std::unique_ptr<cc::GLFrameData> gl_frame_data); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 87 CompositorOutputSurface* output_surface_; | 88 CompositorOutputSurface* output_surface_; |
| 88 | 89 |
| 89 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); | 90 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 void OnMessageReceived(const IPC::Message& message); | 93 void OnMessageReceived(const IPC::Message& message); |
| 93 void OnUpdateVSyncParametersFromBrowser(base::TimeTicks timebase, | 94 void OnUpdateVSyncParametersFromBrowser(base::TimeTicks timebase, |
| 94 base::TimeDelta interval); | 95 base::TimeDelta interval); |
| 95 bool Send(IPC::Message* message); | 96 bool Send(IPC::Message* message); |
| 96 | 97 |
| 97 bool use_swap_compositor_frame_message_; | |
| 98 | |
| 99 scoped_refptr<CompositorForwardingMessageFilter> output_surface_filter_; | 98 scoped_refptr<CompositorForwardingMessageFilter> output_surface_filter_; |
| 100 CompositorForwardingMessageFilter::Handler output_surface_filter_handler_; | 99 CompositorForwardingMessageFilter::Handler output_surface_filter_handler_; |
| 101 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; | 100 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; |
| 102 scoped_refptr<IPC::SyncMessageFilter> message_sender_; | 101 scoped_refptr<IPC::SyncMessageFilter> message_sender_; |
| 103 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; | 102 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
| 104 int routing_id_; | 103 int routing_id_; |
| 105 | 104 |
| 106 // TODO(danakj): Remove this when crbug.com/311404 | 105 // TODO(danakj): Remove this when crbug.com/311404 |
| 107 bool layout_test_mode_; | 106 bool layout_test_mode_; |
| 108 std::unique_ptr<cc::CompositorFrameAck> layout_test_previous_frame_ack_; | 107 std::unique_ptr<cc::CompositorFrameAck> layout_test_previous_frame_ack_; |
| 109 base::WeakPtrFactory<CompositorOutputSurface> weak_ptrs_; | 108 base::WeakPtrFactory<CompositorOutputSurface> weak_ptrs_; |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 } // namespace content | 111 } // namespace content |
| 113 | 112 |
| 114 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 113 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |