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

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

Issue 614073005: Allow CopyOutputRequests on all render passes of a surface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « no previous file | cc/surfaces/surface.cc » ('j') | cc/surfaces/surface_aggregator.cc » ('J')
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_H_ 5 #ifndef CC_SURFACES_SURFACE_H_
6 #define CC_SURFACES_SURFACE_H_ 6 #define CC_SURFACES_SURFACE_H_
7 7
8 #include <map>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "cc/base/scoped_ptr_vector.h" 16 #include "cc/base/scoped_ptr_vector.h"
16 #include "cc/output/copy_output_request.h" 17 #include "cc/output/copy_output_request.h"
18 #include "cc/quads/render_pass_id.h"
17 #include "cc/surfaces/surface_id.h" 19 #include "cc/surfaces/surface_id.h"
18 #include "cc/surfaces/surfaces_export.h" 20 #include "cc/surfaces/surfaces_export.h"
19 #include "ui/gfx/size.h" 21 #include "ui/gfx/size.h"
20 22
21 namespace ui { 23 namespace ui {
22 struct LatencyInfo; 24 struct LatencyInfo;
23 } 25 }
24 26
25 namespace cc { 27 namespace cc {
26 class CompositorFrame; 28 class CompositorFrame;
27 class CopyOutputRequest; 29 class CopyOutputRequest;
28 class SurfaceManager; 30 class SurfaceManager;
29 class SurfaceFactory; 31 class SurfaceFactory;
30 class SurfaceResourceHolder; 32 class SurfaceResourceHolder;
31 33
32 class CC_SURFACES_EXPORT Surface { 34 class CC_SURFACES_EXPORT Surface {
33 public: 35 public:
34 Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory); 36 Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory);
35 ~Surface(); 37 ~Surface();
36 38
37 const gfx::Size& size() const { return size_; } 39 const gfx::Size& size() const { return size_; }
38 SurfaceId surface_id() const { return surface_id_; } 40 SurfaceId surface_id() const { return surface_id_; }
39 41
40 void QueueFrame(scoped_ptr<CompositorFrame> frame, 42 void QueueFrame(scoped_ptr<CompositorFrame> frame,
41 const base::Closure& draw_callback); 43 const base::Closure& draw_callback);
42 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request); 44 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request);
45 // Adds each CopyOutputRequest in the current frame to copy_requests. The
46 // caller takes ownership of them.
43 void TakeCopyOutputRequests( 47 void TakeCopyOutputRequests(
44 ScopedPtrVector<CopyOutputRequest>* copy_requests); 48 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests);
45 // Returns the most recent frame that is eligible to be rendered. 49 // Returns the most recent frame that is eligible to be rendered.
46 const CompositorFrame* GetEligibleFrame(); 50 const CompositorFrame* GetEligibleFrame();
47 51
48 // Returns a number that increments by 1 every time a new frame is enqueued. 52 // Returns a number that increments by 1 every time a new frame is enqueued.
49 int frame_index() const { return frame_index_; } 53 int frame_index() const { return frame_index_; }
50 54
51 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info); 55 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info);
52 void RunDrawCallbacks(); 56 void RunDrawCallbacks();
53 57
54 base::WeakPtr<SurfaceFactory> factory() { return factory_; } 58 base::WeakPtr<SurfaceFactory> factory() { return factory_; }
55 59
56 private: 60 private:
61 void ClearCopyRequests();
62
57 SurfaceId surface_id_; 63 SurfaceId surface_id_;
58 gfx::Size size_; 64 gfx::Size size_;
59 base::WeakPtr<SurfaceFactory> factory_; 65 base::WeakPtr<SurfaceFactory> factory_;
60 // TODO(jamesr): Support multiple frames in flight. 66 // TODO(jamesr): Support multiple frames in flight.
61 scoped_ptr<CompositorFrame> current_frame_; 67 scoped_ptr<CompositorFrame> current_frame_;
62 int frame_index_; 68 int frame_index_;
63 ScopedPtrVector<CopyOutputRequest> copy_requests_;
64 69
65 base::Closure draw_callback_; 70 base::Closure draw_callback_;
66 71
67 DISALLOW_COPY_AND_ASSIGN(Surface); 72 DISALLOW_COPY_AND_ASSIGN(Surface);
68 }; 73 };
69 74
70 } // namespace cc 75 } // namespace cc
71 76
72 #endif // CC_SURFACES_SURFACE_H_ 77 #endif // CC_SURFACES_SURFACE_H_
OLDNEW
« no previous file with comments | « no previous file | cc/surfaces/surface.cc » ('j') | cc/surfaces/surface_aggregator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698