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 "mojo/skia/ganesh_context.h" | 10 #include "mojo/skia/ganesh_context.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 ResourceManager* resource_manager() const { | 36 ResourceManager* resource_manager() const { |
37 return const_cast<ResourceManager*>(&resource_manager_); | 37 return const_cast<ResourceManager*>(&resource_manager_); |
38 } | 38 } |
39 | 39 |
40 void SetNeedsAnimate(); | 40 void SetNeedsAnimate(); |
41 void SetRootLayer(scoped_refptr<Layer> layer); | 41 void SetRootLayer(scoped_refptr<Layer> layer); |
42 | 42 |
43 private: | 43 private: |
| 44 enum State { |
| 45 kIdle, |
| 46 kWaitingForBeginFrame, |
| 47 kProducingFrame, |
| 48 kWaitingForSurfaceToUploadFrame, |
| 49 }; |
| 50 |
44 // SurfaceHolder::Client | 51 // SurfaceHolder::Client |
45 void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) override; | 52 void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) override; |
46 void ReturnResources( | 53 void ReturnResources( |
47 mojo::Array<mojo::ReturnedResourcePtr> resources) override; | 54 mojo::Array<mojo::ReturnedResourcePtr> resources) override; |
48 | 55 |
49 // Scheduler::Client | 56 // Scheduler::Client |
50 void BeginFrame(base::TimeTicks frame_time, | 57 void BeginFrame(base::TimeTicks frame_time, |
51 base::TimeTicks deadline) override; | 58 base::TimeTicks deadline) override; |
52 | 59 |
53 void Upload(Layer* layer); | 60 void Upload(Layer* layer); |
54 | 61 |
55 LayerHostClient* client_; | 62 LayerHostClient* client_; |
| 63 State state_; |
56 SurfaceHolder surface_holder_; | 64 SurfaceHolder surface_holder_; |
57 base::WeakPtr<mojo::GLContext> gl_context_; | 65 base::WeakPtr<mojo::GLContext> gl_context_; |
58 mojo::GaneshContext ganesh_context_; | 66 mojo::GaneshContext ganesh_context_; |
59 ResourceManager resource_manager_; | 67 ResourceManager resource_manager_; |
60 Scheduler scheduler_; | 68 Scheduler scheduler_; |
61 | 69 |
62 scoped_refptr<Layer> root_layer_; | 70 scoped_refptr<Layer> root_layer_; |
63 | 71 |
64 DISALLOW_COPY_AND_ASSIGN(LayerHost); | 72 DISALLOW_COPY_AND_ASSIGN(LayerHost); |
65 }; | 73 }; |
66 | 74 |
67 } // namespace sky | 75 } // namespace sky |
68 | 76 |
69 #endif // SKY_COMPOSITOR_LAYER_HOST_H_ | 77 #endif // SKY_COMPOSITOR_LAYER_HOST_H_ |
OLD | NEW |