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

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

Issue 1304063014: cc: Plumbing for BeginFrameSource based on Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix webview Created 5 years, 2 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_display_output_surface.cc ('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 "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "cc/output/compositor_frame.h" 15 #include "cc/output/compositor_frame.h"
16 #include "cc/surfaces/surface_id.h" 16 #include "cc/surfaces/surface_id.h"
17 #include "cc/surfaces/surface_resource_holder.h" 17 #include "cc/surfaces/surface_resource_holder.h"
18 #include "cc/surfaces/surface_sequence.h" 18 #include "cc/surfaces/surface_sequence.h"
19 #include "cc/surfaces/surfaces_export.h" 19 #include "cc/surfaces/surfaces_export.h"
20 20
21 namespace gfx { 21 namespace gfx {
22 class Size; 22 class Size;
23 } 23 }
24 24
25 namespace cc { 25 namespace cc {
26 class BeginFrameSource;
26 class CopyOutputRequest; 27 class CopyOutputRequest;
27 class Surface; 28 class Surface;
28 class SurfaceFactoryClient; 29 class SurfaceFactoryClient;
29 class SurfaceManager; 30 class SurfaceManager;
30 31
31 enum class SurfaceDrawStatus { DRAW_SKIPPED, DRAWN }; 32 enum class SurfaceDrawStatus { DRAW_SKIPPED, DRAWN };
32 33
33 // A SurfaceFactory is used to create surfaces that may share resources and 34 // A SurfaceFactory is used to create surfaces that may share resources and
34 // receive returned resources for frames submitted to those surfaces. Resources 35 // receive returned resources for frames submitted to those surfaces. Resources
35 // submitted to frames created by a particular factory will be returned to that 36 // submitted to frames created by a particular factory will be returned to that
36 // factory's client when they are no longer being used. This is the only class 37 // factory's client when they are no longer being used. This is the only class
37 // most users of surfaces will need to directly interact with. 38 // most users of surfaces will need to directly interact with.
38 class CC_SURFACES_EXPORT SurfaceFactory 39 class CC_SURFACES_EXPORT SurfaceFactory
39 : public base::SupportsWeakPtr<SurfaceFactory> { 40 : public base::SupportsWeakPtr<SurfaceFactory> {
40 public: 41 public:
41 using DrawCallback = base::Callback<void(SurfaceDrawStatus)>; 42 using DrawCallback = base::Callback<void(SurfaceDrawStatus)>;
42 43
43 SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client); 44 SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client);
44 ~SurfaceFactory(); 45 ~SurfaceFactory();
45 46
46 void Create(SurfaceId surface_id); 47 void Create(SurfaceId surface_id);
47 void Destroy(SurfaceId surface_id); 48 void Destroy(SurfaceId surface_id);
48 void DestroyAll(); 49 void DestroyAll();
50
51 void SetBeginFrameSource(SurfaceId surface_id,
52 BeginFrameSource* begin_frame_source);
53
49 // A frame can only be submitted to a surface created by this factory, 54 // A frame can only be submitted to a surface created by this factory,
50 // although the frame may reference surfaces created by other factories. 55 // although the frame may reference surfaces created by other factories.
51 // The callback is called the first time this frame is used to draw, or if 56 // The callback is called the first time this frame is used to draw, or if
52 // the frame is discarded. 57 // the frame is discarded.
53 void SubmitCompositorFrame(SurfaceId surface_id, 58 void SubmitCompositorFrame(SurfaceId surface_id,
54 scoped_ptr<CompositorFrame> frame, 59 scoped_ptr<CompositorFrame> frame,
55 const DrawCallback& callback); 60 const DrawCallback& callback);
56 void RequestCopyOfSurface(SurfaceId surface_id, 61 void RequestCopyOfSurface(SurfaceId surface_id,
57 scoped_ptr<CopyOutputRequest> copy_request); 62 scoped_ptr<CopyOutputRequest> copy_request);
58 63
(...skipping 23 matching lines...) Expand all
82 typedef base::ScopedPtrHashMap<SurfaceId, scoped_ptr<Surface>> 87 typedef base::ScopedPtrHashMap<SurfaceId, scoped_ptr<Surface>>
83 OwningSurfaceMap; 88 OwningSurfaceMap;
84 OwningSurfaceMap surface_map_; 89 OwningSurfaceMap surface_map_;
85 90
86 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); 91 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory);
87 }; 92 };
88 93
89 } // namespace cc 94 } // namespace cc
90 95
91 #endif // CC_SURFACES_SURFACE_FACTORY_H_ 96 #endif // CC_SURFACES_SURFACE_FACTORY_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_display_output_surface.cc ('k') | cc/surfaces/surface_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698