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

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

Issue 553213003: Avoid destroying surface before the parent surface stops referencing it. (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 | « cc/output/compositor_frame_metadata.h ('k') | 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 "base/memory/weak_ptr.h"
14 #include "cc/base/scoped_ptr_vector.h" 15 #include "cc/base/scoped_ptr_vector.h"
15 #include "cc/output/copy_output_request.h" 16 #include "cc/output/copy_output_request.h"
16 #include "cc/surfaces/surface_id.h" 17 #include "cc/surfaces/surface_id.h"
17 #include "cc/surfaces/surfaces_export.h" 18 #include "cc/surfaces/surfaces_export.h"
18 #include "ui/gfx/size.h" 19 #include "ui/gfx/size.h"
19 20
20 namespace ui { 21 namespace ui {
21 struct LatencyInfo; 22 struct LatencyInfo;
22 } 23 }
23 24
(...skipping 19 matching lines...) Expand all
43 ScopedPtrVector<CopyOutputRequest>* copy_requests); 44 ScopedPtrVector<CopyOutputRequest>* copy_requests);
44 // Returns the most recent frame that is eligible to be rendered. 45 // Returns the most recent frame that is eligible to be rendered.
45 const CompositorFrame* GetEligibleFrame(); 46 const CompositorFrame* GetEligibleFrame();
46 47
47 // Returns a number that increments by 1 every time a new frame is enqueued. 48 // Returns a number that increments by 1 every time a new frame is enqueued.
48 int frame_index() const { return frame_index_; } 49 int frame_index() const { return frame_index_; }
49 50
50 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info); 51 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info);
51 void RunDrawCallbacks(); 52 void RunDrawCallbacks();
52 53
53 SurfaceFactory* factory() { return factory_; } 54 base::WeakPtr<SurfaceFactory> factory() { return factory_; }
54 55
55 private: 56 private:
56 SurfaceId surface_id_; 57 SurfaceId surface_id_;
57 gfx::Size size_; 58 gfx::Size size_;
58 SurfaceFactory* factory_; 59 base::WeakPtr<SurfaceFactory> factory_;
59 // TODO(jamesr): Support multiple frames in flight. 60 // TODO(jamesr): Support multiple frames in flight.
60 scoped_ptr<CompositorFrame> current_frame_; 61 scoped_ptr<CompositorFrame> current_frame_;
61 int frame_index_; 62 int frame_index_;
62 ScopedPtrVector<CopyOutputRequest> copy_requests_; 63 ScopedPtrVector<CopyOutputRequest> copy_requests_;
63 64
64 base::Closure draw_callback_; 65 base::Closure draw_callback_;
65 66
66 DISALLOW_COPY_AND_ASSIGN(Surface); 67 DISALLOW_COPY_AND_ASSIGN(Surface);
67 }; 68 };
68 69
69 } // namespace cc 70 } // namespace cc
70 71
71 #endif // CC_SURFACES_SURFACE_H_ 72 #endif // CC_SURFACES_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/output/compositor_frame_metadata.h ('k') | cc/surfaces/surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698