OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SKY_COMPOSITOR_LAYER_HOST_H_ | 5 #ifndef SKY_COMPOSITOR_LAYER_HOST_H_ |
6 #define SKY_COMPOSITOR_LAYER_HOST_H_ | 6 #define SKY_COMPOSITOR_LAYER_HOST_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 return const_cast<ResourceManager*>(&resource_manager_); | 38 return const_cast<ResourceManager*>(&resource_manager_); |
39 } | 39 } |
40 | 40 |
41 void SetNeedsAnimate(); | 41 void SetNeedsAnimate(); |
42 void SetRootLayer(scoped_refptr<Layer> layer); | 42 void SetRootLayer(scoped_refptr<Layer> layer); |
43 | 43 |
44 void GetPixelsForTesting(std::vector<unsigned char>* pixels); | 44 void GetPixelsForTesting(std::vector<unsigned char>* pixels); |
45 | 45 |
46 private: | 46 private: |
47 enum State { | 47 enum State { |
48 kWaitingForSurfaceService, | |
49 kReadyForFrame, | 48 kReadyForFrame, |
50 kWaitingForFrameAcknowldgement, | 49 kWaitingForFrameAcknowldgement, |
51 }; | 50 }; |
52 | 51 |
53 // SurfaceHolder::Client | 52 // SurfaceHolder::Client |
54 void OnSurfaceConnectionCreated() override; | |
55 void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) override; | 53 void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) override; |
56 void ReturnResources( | 54 void ReturnResources( |
57 mojo::Array<mojo::ReturnedResourcePtr> resources) override; | 55 mojo::Array<mojo::ReturnedResourcePtr> resources) override; |
58 | 56 |
59 void BeginFrameSoon(); | 57 void BeginFrameSoon(); |
60 void BeginFrame(); | 58 void BeginFrame(); |
61 | 59 |
62 void Upload(Layer* layer); | 60 void Upload(Layer* layer); |
63 void DidCompleteFrame(); | 61 void DidCompleteFrame(); |
64 | 62 |
65 LayerHostClient* client_; | 63 LayerHostClient* client_; |
66 State state_; | 64 State state_; |
67 bool frame_requested_; | 65 bool frame_requested_; |
68 SurfaceHolder surface_holder_; | 66 SurfaceHolder surface_holder_; |
69 mojo::GLContextOwner gl_context_owner_; | 67 mojo::GLContextOwner gl_context_owner_; |
70 mojo::GaneshContext ganesh_context_; | 68 mojo::GaneshContext ganesh_context_; |
71 ResourceManager resource_manager_; | 69 ResourceManager resource_manager_; |
72 scoped_refptr<Layer> root_layer_; | 70 scoped_refptr<Layer> root_layer_; |
73 | 71 |
74 base::WeakPtrFactory<LayerHost> weak_factory_; | 72 base::WeakPtrFactory<LayerHost> weak_factory_; |
75 | 73 |
76 DISALLOW_COPY_AND_ASSIGN(LayerHost); | 74 DISALLOW_COPY_AND_ASSIGN(LayerHost); |
77 }; | 75 }; |
78 | 76 |
79 } // namespace sky | 77 } // namespace sky |
80 | 78 |
81 #endif // SKY_COMPOSITOR_LAYER_HOST_H_ | 79 #endif // SKY_COMPOSITOR_LAYER_HOST_H_ |
OLD | NEW |