| 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> |
| 11 |
| 10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
| 16 #include "base/threading/platform_thread.h" | 17 #include "base/threading/platform_thread.h" |
| 17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 19 #include "cc/output/begin_frame_args.h" | 20 #include "cc/output/begin_frame_args.h" |
| 20 #include "cc/output/output_surface.h" | 21 #include "cc/output/output_surface.h" |
| 21 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" | 22 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" |
| 22 #include "ipc/ipc_sync_message_filter.h" | 23 #include "ipc/ipc_sync_message_filter.h" |
| 23 | 24 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 public: | 44 public: |
| 44 CompositorOutputSurface( | 45 CompositorOutputSurface( |
| 45 int32_t routing_id, | 46 int32_t routing_id, |
| 46 uint32_t output_surface_id, | 47 uint32_t output_surface_id, |
| 47 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 48 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
| 48 const scoped_refptr<ContextProviderCommandBuffer>& | 49 const scoped_refptr<ContextProviderCommandBuffer>& |
| 49 worker_context_provider, | 50 worker_context_provider, |
| 50 #if defined(ENABLE_VULKAN) | 51 #if defined(ENABLE_VULKAN) |
| 51 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, | 52 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, |
| 52 #endif | 53 #endif |
| 53 scoped_ptr<cc::SoftwareOutputDevice> software, | 54 std::unique_ptr<cc::SoftwareOutputDevice> software, |
| 54 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue, | 55 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue, |
| 55 bool use_swap_compositor_frame_message); | 56 bool use_swap_compositor_frame_message); |
| 56 ~CompositorOutputSurface() override; | 57 ~CompositorOutputSurface() override; |
| 57 | 58 |
| 58 // cc::OutputSurface implementation. | 59 // cc::OutputSurface implementation. |
| 59 bool BindToClient(cc::OutputSurfaceClient* client) override; | 60 bool BindToClient(cc::OutputSurfaceClient* client) override; |
| 60 void DetachFromClient() override; | 61 void DetachFromClient() override; |
| 61 void SwapBuffers(cc::CompositorFrame* frame) override; | 62 void SwapBuffers(cc::CompositorFrame* frame) override; |
| 62 | 63 |
| 63 protected: | 64 protected: |
| 64 void ShortcutSwapAck(uint32_t output_surface_id, | 65 void ShortcutSwapAck(uint32_t output_surface_id, |
| 65 scoped_ptr<cc::GLFrameData> gl_frame_data); | 66 std::unique_ptr<cc::GLFrameData> gl_frame_data); |
| 66 virtual void OnSwapAck(uint32_t output_surface_id, | 67 virtual void OnSwapAck(uint32_t output_surface_id, |
| 67 const cc::CompositorFrameAck& ack); | 68 const cc::CompositorFrameAck& ack); |
| 68 virtual void OnReclaimResources(uint32_t output_surface_id, | 69 virtual void OnReclaimResources(uint32_t output_surface_id, |
| 69 const cc::CompositorFrameAck& ack); | 70 const cc::CompositorFrameAck& ack); |
| 70 uint32_t output_surface_id_; | 71 uint32_t output_surface_id_; |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 class CompositorOutputSurfaceProxy : | 74 class CompositorOutputSurfaceProxy : |
| 74 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { | 75 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { |
| 75 public: | 76 public: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 99 | 100 |
| 100 scoped_refptr<CompositorForwardingMessageFilter> output_surface_filter_; | 101 scoped_refptr<CompositorForwardingMessageFilter> output_surface_filter_; |
| 101 CompositorForwardingMessageFilter::Handler output_surface_filter_handler_; | 102 CompositorForwardingMessageFilter::Handler output_surface_filter_handler_; |
| 102 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; | 103 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; |
| 103 scoped_refptr<IPC::SyncMessageFilter> message_sender_; | 104 scoped_refptr<IPC::SyncMessageFilter> message_sender_; |
| 104 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; | 105 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
| 105 int routing_id_; | 106 int routing_id_; |
| 106 | 107 |
| 107 // TODO(danakj): Remove this when crbug.com/311404 | 108 // TODO(danakj): Remove this when crbug.com/311404 |
| 108 bool layout_test_mode_; | 109 bool layout_test_mode_; |
| 109 scoped_ptr<cc::CompositorFrameAck> layout_test_previous_frame_ack_; | 110 std::unique_ptr<cc::CompositorFrameAck> layout_test_previous_frame_ack_; |
| 110 base::WeakPtrFactory<CompositorOutputSurface> weak_ptrs_; | 111 base::WeakPtrFactory<CompositorOutputSurface> weak_ptrs_; |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 } // namespace content | 114 } // namespace content |
| 114 | 115 |
| 115 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 116 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |