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_BLIMP_OUTPUT_SURFACE_H_ | |
6 #define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_OUTPUT_SURFACE_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 // This class is a proxy for the BlimpOutputSurfaceClient to interact with the | |
20 // DelegatedOutputSurface. It should be called on the compositor thread only. | |
21 class BlimpOutputSurface { | |
22 public: | |
23 virtual ~BlimpOutputSurface() {} | |
24 | |
25 // Sent when the compositor can reclaim the |resources| references in a | |
26 // 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. It should be called on the main thread | |
33 // only. | |
34 class BlimpOutputSurfaceClient { | |
35 public: | |
36 virtual ~BlimpOutputSurfaceClient() {} | |
37 | |
38 // Will be called before any frames are sent to the client. The weak ptr | |
39 // provided here can be used to post messages to the output surface on the | |
40 // compositor thread. | |
41 virtual void BindToOutputSurface( | |
42 base::WeakPtr<BlimpOutputSurface> output_surface) = 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 drawn | |
46 // using BlimpOutputSurface::ReclaimCompositorResources. | |
47 virtual void SwapCompositorFrame(cc::CompositorFrame frame) = 0; | |
48 | |
49 // Will be called when the use of the OutputSurface is being terminated. No | |
50 // calls from this output surface will be made to the client after this point. | |
51 virtual void UnbindOutputSurface() = 0; | |
52 }; | |
53 | |
54 } // namespace client | |
55 } // namespace blimp | |
56 | |
57 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_OUTPUT_SURFACE_H_ | |
OLD | NEW |