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
3 // found in the LICENSE file.
5 #ifndef CC_SURFACES_SURFACE_H_
6 #define CC_SURFACES_SURFACE_H_
8 #include "base/containers/hash_tables.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/surfaces/surface_id.h"
12 #include "cc/surfaces/surfaces_export.h"
13 #include "ui/gfx/size.h"
16 class CompositorFrame;
19 class SurfaceResourceHolder;
21 class CC_SURFACES_EXPORT Surface {
23 Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory);
26 const gfx::Size& size() const { return size_; }
27 SurfaceId surface_id() const { return surface_id_; }
29 void QueueFrame(scoped_ptr<CompositorFrame> frame);
30 // Returns the most recent frame that is eligible to be rendered.
31 const CompositorFrame* GetEligibleFrame();
33 SurfaceFactory* factory() { return factory_; }
36 SurfaceId surface_id_;
38 SurfaceFactory* factory_;
39 // TODO(jamesr): Support multiple frames in flight.
40 scoped_ptr<CompositorFrame> current_frame_;
42 DISALLOW_COPY_AND_ASSIGN(Surface);
47 #endif // CC_SURFACES_SURFACE_H_