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.h

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

Powered by Google App Engine
This is Rietveld 408576698