| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ |
| 6 #define CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ | 6 #define CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 15 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
| 16 #include "cc/output/context_provider.h" | 15 #include "cc/output/context_provider.h" |
| 17 #include "cc/output/overlay_candidate_validator.h" | 16 #include "cc/output/overlay_candidate_validator.h" |
| 18 #include "cc/output/vulkan_context_provider.h" | 17 #include "cc/output/vulkan_context_provider.h" |
| 19 #include "cc/resources/returned_resource.h" | 18 #include "cc/resources/returned_resource.h" |
| 20 #include "gpu/command_buffer/common/texture_in_use_response.h" | 19 #include "gpu/command_buffer/common/texture_in_use_response.h" |
| 21 #include "ui/gfx/color_space.h" | 20 #include "ui/gfx/color_space.h" |
| 22 | 21 |
| 23 namespace ui { | 22 namespace ui { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // CompositorFrameSink::Invalidate is called by the compositor to notify that | 104 // CompositorFrameSink::Invalidate is called by the compositor to notify that |
| 106 // there's new content. | 105 // there's new content. |
| 107 virtual void Invalidate() {} | 106 virtual void Invalidate() {} |
| 108 | 107 |
| 109 // For successful swaps, the implementation must call DidSwapBuffersComplete() | 108 // For successful swaps, the implementation must call DidSwapBuffersComplete() |
| 110 // (via OnSwapBuffersComplete()) eventually. | 109 // (via OnSwapBuffersComplete()) eventually. |
| 111 virtual void SwapBuffers(CompositorFrame frame) = 0; | 110 virtual void SwapBuffers(CompositorFrame frame) = 0; |
| 112 virtual void OnSwapBuffersComplete(); | 111 virtual void OnSwapBuffersComplete(); |
| 113 | 112 |
| 114 protected: | 113 protected: |
| 115 // This is used by both display and delegating implementations. | |
| 116 void PostSwapBuffersComplete(); | |
| 117 | |
| 118 // Bound to the ContextProvider to hear about when it is lost and inform the | 114 // Bound to the ContextProvider to hear about when it is lost and inform the |
| 119 // |client_|. | 115 // |client_|. |
| 120 void DidLoseCompositorFrameSink(); | 116 void DidLoseCompositorFrameSink(); |
| 121 | 117 |
| 122 CompositorFrameSinkClient* client_ = nullptr; | 118 CompositorFrameSinkClient* client_ = nullptr; |
| 123 | 119 |
| 124 struct CompositorFrameSink::Capabilities capabilities_; | 120 struct CompositorFrameSink::Capabilities capabilities_; |
| 125 scoped_refptr<ContextProvider> context_provider_; | 121 scoped_refptr<ContextProvider> context_provider_; |
| 126 scoped_refptr<ContextProvider> worker_context_provider_; | 122 scoped_refptr<ContextProvider> worker_context_provider_; |
| 127 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; | 123 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; |
| 128 base::ThreadChecker client_thread_checker_; | 124 base::ThreadChecker client_thread_checker_; |
| 129 | 125 |
| 130 private: | 126 private: |
| 131 void DetachFromClientInternal(); | 127 void DetachFromClientInternal(); |
| 132 | 128 |
| 133 base::WeakPtrFactory<CompositorFrameSink> weak_ptr_factory_; | |
| 134 | |
| 135 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); | 129 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); |
| 136 }; | 130 }; |
| 137 | 131 |
| 138 } // namespace cc | 132 } // namespace cc |
| 139 | 133 |
| 140 #endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ | 134 #endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |