Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: cc/surfaces/surface_factory.h

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/surfaces/surface_damage_observer.h ('k') | cc/surfaces/surface_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_FACTORY_H_ 5 #ifndef CC_SURFACES_SURFACE_FACTORY_H_
6 #define CC_SURFACES_SURFACE_FACTORY_H_ 6 #define CC_SURFACES_SURFACE_FACTORY_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/containers/scoped_ptr_hash_map.h" 11 #include "base/containers/scoped_ptr_hash_map.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "cc/surfaces/surface_id.h" 14 #include "cc/surfaces/surface_id.h"
15 #include "cc/surfaces/surface_resource_holder.h" 15 #include "cc/surfaces/surface_resource_holder.h"
16 #include "cc/surfaces/surface_sequence.h" 16 #include "cc/surfaces/surface_sequence.h"
17 #include "cc/surfaces/surfaces_export.h" 17 #include "cc/surfaces/surfaces_export.h"
18 18
19 namespace gfx { 19 namespace gfx {
20 class Size; 20 class Size;
21 } 21 }
22 22
23 namespace cc { 23 namespace cc {
24 class CompositorFrame; 24 class CompositorFrame;
25 class CopyOutputRequest; 25 class CopyOutputRequest;
26 class Surface; 26 class Surface;
27 class SurfaceFactoryClient; 27 class SurfaceFactoryClient;
28 class SurfaceManager; 28 class SurfaceManager;
29 29
30 enum class SurfaceDrawStatus { DRAW_SKIPPED, DRAWN };
31
30 // A SurfaceFactory is used to create surfaces that may share resources and 32 // A SurfaceFactory is used to create surfaces that may share resources and
31 // receive returned resources for frames submitted to those surfaces. Resources 33 // receive returned resources for frames submitted to those surfaces. Resources
32 // submitted to frames created by a particular factory will be returned to that 34 // submitted to frames created by a particular factory will be returned to that
33 // factory's client when they are no longer being used. This is the only class 35 // factory's client when they are no longer being used. This is the only class
34 // most users of surfaces will need to directly interact with. 36 // most users of surfaces will need to directly interact with.
35 class CC_SURFACES_EXPORT SurfaceFactory 37 class CC_SURFACES_EXPORT SurfaceFactory
36 : public base::SupportsWeakPtr<SurfaceFactory> { 38 : public base::SupportsWeakPtr<SurfaceFactory> {
37 public: 39 public:
38 // This callback is called with true if the frame was drawn, or false if it 40 using DrawCallback = base::Callback<void(SurfaceDrawStatus)>;
39 // was discarded.
40 using DrawCallback = base::Callback<void(bool)>;
41 41
42 SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client); 42 SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client);
43 ~SurfaceFactory(); 43 ~SurfaceFactory();
44 44
45 void Create(SurfaceId surface_id); 45 void Create(SurfaceId surface_id);
46 void Destroy(SurfaceId surface_id); 46 void Destroy(SurfaceId surface_id);
47 void DestroyAll(); 47 void DestroyAll();
48 // A frame can only be submitted to a surface created by this factory, 48 // A frame can only be submitted to a surface created by this factory,
49 // although the frame may reference surfaces created by other factories. 49 // although the frame may reference surfaces created by other factories.
50 // The callback is called the first time this frame is used to draw, or if 50 // The callback is called the first time this frame is used to draw, or if
(...skipping 19 matching lines...) Expand all
70 70
71 typedef base::ScopedPtrHashMap<SurfaceId, Surface> OwningSurfaceMap; 71 typedef base::ScopedPtrHashMap<SurfaceId, Surface> OwningSurfaceMap;
72 base::ScopedPtrHashMap<SurfaceId, Surface> surface_map_; 72 base::ScopedPtrHashMap<SurfaceId, Surface> surface_map_;
73 73
74 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); 74 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory);
75 }; 75 };
76 76
77 } // namespace cc 77 } // namespace cc
78 78
79 #endif // CC_SURFACES_SURFACE_FACTORY_H_ 79 #endif // CC_SURFACES_SURFACE_FACTORY_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_damage_observer.h ('k') | cc/surfaces/surface_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698