OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BLIMP_CLIENT_CORE_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_ |
| 6 #define BLIMP_CLIENT_CORE_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "cc/resources/returned_resource.h" |
| 11 |
| 12 namespace cc { |
| 13 class CompositorFrame; |
| 14 } |
| 15 |
| 16 namespace blimp { |
| 17 namespace client { |
| 18 |
| 19 // The client is the class for the proxy to interact with the cc::OutputSurface. |
| 20 // It should only be called on the compositor thread. |
| 21 class OutputSurfaceProxyClient { |
| 22 public: |
| 23 virtual ~OutputSurfaceProxyClient() {} |
| 24 |
| 25 // Sent when the compositor can safely reclaim the |resources| references in |
| 26 // a compositor frame. |
| 27 virtual void ReclaimCompositorResources( |
| 28 const cc::ReturnedResourceArray& resources) = 0; |
| 29 }; |
| 30 |
| 31 // This class is meant to be a proxy for the OutputSurface to interact with the |
| 32 // consumer of the CompositorFrames. All calls to the OutputSurfaceProxy are |
| 33 // made on the thread on which proxy exists. |
| 34 class OutputSurfaceProxy { |
| 35 public: |
| 36 virtual ~OutputSurfaceProxy() {} |
| 37 |
| 38 // Will be called when the cc::OutputSurface is bound to its client on the |
| 39 // compositor thread. The weak ptr to the client can be used to post messages |
| 40 // to it on the compositor thread. This *must* be called before any messages |
| 41 // are sent to the proxy. |
| 42 virtual void BindToClient(base::WeakPtr<OutputSurfaceProxyClient> client) = 0; |
| 43 |
| 44 // The implementation should take the contents of the compositor frame and |
| 45 // return the referenced resources when the frame is no longer being draw |
| 46 // using OutputSurfaceProxyClient::ReclaimCompositorResources. |
| 47 virtual void SwapCompositorFrame(cc::CompositorFrame frame) = 0; |
| 48 |
| 49 // Will be called when the cc::OutputSurface detaches itself from its client |
| 50 // on the compositor thread. Any messages sent to the client beyond this point |
| 51 // will be silently dropped and no more messages can be sent to the proxy |
| 52 // going forward. |
| 53 virtual void DetachFromClient() = 0; |
| 54 }; |
| 55 |
| 56 } // namespace client |
| 57 } // namespace blimp |
| 58 |
| 59 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_ |
OLD | NEW |