| 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 CC_SURFACES_SURFACE_H_ | 5 #ifndef CC_SURFACES_SURFACE_H_ |
| 6 #define CC_SURFACES_SURFACE_H_ | 6 #define CC_SURFACES_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" |
| 8 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/surfaces/surface_id.h" | 12 #include "cc/surfaces/surface_id.h" |
| 12 #include "cc/surfaces/surfaces_export.h" | 13 #include "cc/surfaces/surfaces_export.h" |
| 13 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 class CompositorFrame; | 17 class CompositorFrame; |
| 17 class SurfaceManager; | 18 class SurfaceManager; |
| 18 class SurfaceFactory; | 19 class SurfaceFactory; |
| 19 class SurfaceResourceHolder; | 20 class SurfaceResourceHolder; |
| 20 | 21 |
| 21 class CC_SURFACES_EXPORT Surface { | 22 class CC_SURFACES_EXPORT Surface { |
| 22 public: | 23 public: |
| 23 Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory); | 24 Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory); |
| 24 ~Surface(); | 25 ~Surface(); |
| 25 | 26 |
| 26 const gfx::Size& size() const { return size_; } | 27 const gfx::Size& size() const { return size_; } |
| 27 SurfaceId surface_id() const { return surface_id_; } | 28 SurfaceId surface_id() const { return surface_id_; } |
| 28 | 29 |
| 29 void QueueFrame(scoped_ptr<CompositorFrame> frame); | 30 void QueueFrame(scoped_ptr<CompositorFrame> frame, |
| 31 const base::Closure& draw_callback); |
| 30 // Returns the most recent frame that is eligible to be rendered. | 32 // Returns the most recent frame that is eligible to be rendered. |
| 31 const CompositorFrame* GetEligibleFrame(); | 33 const CompositorFrame* GetEligibleFrame(); |
| 32 | 34 |
| 35 void RunDrawCallbacks(); |
| 36 |
| 33 SurfaceFactory* factory() { return factory_; } | 37 SurfaceFactory* factory() { return factory_; } |
| 34 | 38 |
| 35 private: | 39 private: |
| 36 SurfaceId surface_id_; | 40 SurfaceId surface_id_; |
| 37 gfx::Size size_; | 41 gfx::Size size_; |
| 38 SurfaceFactory* factory_; | 42 SurfaceFactory* factory_; |
| 39 // TODO(jamesr): Support multiple frames in flight. | 43 // TODO(jamesr): Support multiple frames in flight. |
| 40 scoped_ptr<CompositorFrame> current_frame_; | 44 scoped_ptr<CompositorFrame> current_frame_; |
| 41 | 45 |
| 46 base::Closure draw_callback_; |
| 47 |
| 42 DISALLOW_COPY_AND_ASSIGN(Surface); | 48 DISALLOW_COPY_AND_ASSIGN(Surface); |
| 43 }; | 49 }; |
| 44 | 50 |
| 45 } // namespace cc | 51 } // namespace cc |
| 46 | 52 |
| 47 #endif // CC_SURFACES_SURFACE_H_ | 53 #endif // CC_SURFACES_SURFACE_H_ |
| OLD | NEW |