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

Side by Side Diff: content/browser/compositor/buffer_queue.h

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_
6 #define CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ 6 #define CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <deque> 10 #include <deque>
11 #include <memory>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
18 #include "ui/gfx/geometry/size.h" 18 #include "ui/gfx/geometry/size.h"
19 19
20 namespace cc { 20 namespace cc {
21 class ContextProvider; 21 class ContextProvider;
22 } 22 }
23 23
24 namespace gfx { 24 namespace gfx {
25 class GpuMemoryBuffer; 25 class GpuMemoryBuffer;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return current_surface_ ? current_surface_->texture : 0; 60 return current_surface_ ? current_surface_->texture : 0;
61 } 61 }
62 unsigned int fbo() const { return fbo_; } 62 unsigned int fbo() const { return fbo_; }
63 63
64 private: 64 private:
65 friend class BufferQueueTest; 65 friend class BufferQueueTest;
66 friend class AllocatedSurface; 66 friend class AllocatedSurface;
67 67
68 struct CONTENT_EXPORT AllocatedSurface { 68 struct CONTENT_EXPORT AllocatedSurface {
69 AllocatedSurface(BufferQueue* buffer_queue, 69 AllocatedSurface(BufferQueue* buffer_queue,
70 scoped_ptr<gfx::GpuMemoryBuffer> buffer, 70 std::unique_ptr<gfx::GpuMemoryBuffer> buffer,
71 unsigned int texture, 71 unsigned int texture,
72 unsigned int image, 72 unsigned int image,
73 const gfx::Rect& rect); 73 const gfx::Rect& rect);
74 ~AllocatedSurface(); 74 ~AllocatedSurface();
75 BufferQueue* const buffer_queue; 75 BufferQueue* const buffer_queue;
76 scoped_ptr<gfx::GpuMemoryBuffer> buffer; 76 std::unique_ptr<gfx::GpuMemoryBuffer> buffer;
77 const unsigned int texture; 77 const unsigned int texture;
78 const unsigned int image; 78 const unsigned int image;
79 gfx::Rect damage; // This is the damage for this frame from the previous. 79 gfx::Rect damage; // This is the damage for this frame from the previous.
80 }; 80 };
81 81
82 void FreeAllSurfaces(); 82 void FreeAllSurfaces();
83 83
84 void FreeSurfaceResources(AllocatedSurface* surface); 84 void FreeSurfaceResources(AllocatedSurface* surface);
85 85
86 // Copy everything that is in |copy_rect|, except for what is in 86 // Copy everything that is in |copy_rect|, except for what is in
87 // |exclude_rect| from |source_texture| to |texture|. 87 // |exclude_rect| from |source_texture| to |texture|.
88 virtual void CopyBufferDamage(int texture, 88 virtual void CopyBufferDamage(int texture,
89 int source_texture, 89 int source_texture,
90 const gfx::Rect& new_damage, 90 const gfx::Rect& new_damage,
91 const gfx::Rect& old_damage); 91 const gfx::Rect& old_damage);
92 92
93 void UpdateBufferDamage(const gfx::Rect& damage); 93 void UpdateBufferDamage(const gfx::Rect& damage);
94 94
95 // Return a surface, available to be drawn into. 95 // Return a surface, available to be drawn into.
96 scoped_ptr<AllocatedSurface> GetNextSurface(); 96 std::unique_ptr<AllocatedSurface> GetNextSurface();
97 97
98 scoped_ptr<AllocatedSurface> RecreateBuffer( 98 std::unique_ptr<AllocatedSurface> RecreateBuffer(
99 scoped_ptr<AllocatedSurface> surface); 99 std::unique_ptr<AllocatedSurface> surface);
100 100
101 gfx::Size size_; 101 gfx::Size size_;
102 scoped_refptr<cc::ContextProvider> context_provider_; 102 scoped_refptr<cc::ContextProvider> context_provider_;
103 unsigned int fbo_; 103 unsigned int fbo_;
104 size_t allocated_count_; 104 size_t allocated_count_;
105 unsigned int texture_target_; 105 unsigned int texture_target_;
106 unsigned int internal_format_; 106 unsigned int internal_format_;
107 // This surface is currently bound. This may be nullptr if no surface has 107 // This surface is currently bound. This may be nullptr if no surface has
108 // been bound, or if allocation failed at bind. 108 // been bound, or if allocation failed at bind.
109 scoped_ptr<AllocatedSurface> current_surface_; 109 std::unique_ptr<AllocatedSurface> current_surface_;
110 // The surface currently on the screen, if any. 110 // The surface currently on the screen, if any.
111 scoped_ptr<AllocatedSurface> displayed_surface_; 111 std::unique_ptr<AllocatedSurface> displayed_surface_;
112 // These are free for use, and are not nullptr. 112 // These are free for use, and are not nullptr.
113 std::vector<scoped_ptr<AllocatedSurface>> available_surfaces_; 113 std::vector<std::unique_ptr<AllocatedSurface>> available_surfaces_;
114 // These have been swapped but are not displayed yet. Entries of this deque 114 // These have been swapped but are not displayed yet. Entries of this deque
115 // may be nullptr, if they represent frames that have been destroyed. 115 // may be nullptr, if they represent frames that have been destroyed.
116 std::deque<scoped_ptr<AllocatedSurface>> in_flight_surfaces_; 116 std::deque<std::unique_ptr<AllocatedSurface>> in_flight_surfaces_;
117 GLHelper* gl_helper_; 117 GLHelper* gl_helper_;
118 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 118 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
119 int surface_id_; 119 int surface_id_;
120 120
121 DISALLOW_COPY_AND_ASSIGN(BufferQueue); 121 DISALLOW_COPY_AND_ASSIGN(BufferQueue);
122 }; 122 };
123 123
124 } // namespace content 124 } // namespace content
125 125
126 #endif // CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ 126 #endif // CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698