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

Side by Side Diff: components/display_compositor/buffer_queue.h

Issue 1902463002: Introduce components/display_compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove bot changes. Will do in a separate CL 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
« no previous file with comments | « components/display_compositor/OWNERS ('k') | components/display_compositor/buffer_queue.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 CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ 5 #ifndef COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_
6 #define CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ 6 #define COMPONENTS_DISPLAY_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 <memory>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "content/common/content_export.h" 16 #include "components/display_compositor/display_compositor_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;
26 } 26 }
27 27
28 namespace gpu { 28 namespace gpu {
29 class GpuMemoryBufferManager; 29 class GpuMemoryBufferManager;
30 } 30 }
31 31
32 namespace content { 32 namespace display_compositor {
33 33
34 class GLHelper; 34 class GLHelper;
35 35
36 // Provides a surface that manages its own buffers, backed by GpuMemoryBuffers 36 // Provides a surface that manages its own buffers, backed by GpuMemoryBuffers
37 // created using CHROMIUM_gpu_memory_buffer_image. Double/triple buffering is 37 // created using CHROMIUM_gpu_memory_buffer_image. Double/triple buffering is
38 // implemented internally. Doublebuffering occurs if PageFlipComplete is called 38 // implemented internally. Doublebuffering occurs if PageFlipComplete is called
39 // before the next BindFramebuffer call, otherwise it creates extra buffers. 39 // before the next BindFramebuffer call, otherwise it creates extra buffers.
40 class CONTENT_EXPORT BufferQueue { 40 class DISPLAY_COMPOSITOR_EXPORT BufferQueue {
41 public: 41 public:
42 BufferQueue(scoped_refptr<cc::ContextProvider> context_provider, 42 BufferQueue(scoped_refptr<cc::ContextProvider> context_provider,
43 unsigned int texture_target, 43 unsigned int texture_target,
44 unsigned int internalformat, 44 unsigned int internalformat,
45 GLHelper* gl_helper, 45 GLHelper* gl_helper,
46 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 46 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
47 int surface_id); 47 int surface_id);
48 virtual ~BufferQueue(); 48 virtual ~BufferQueue();
49 49
50 void Initialize(); 50 void Initialize();
51 51
52 void BindFramebuffer(); 52 void BindFramebuffer();
53 void SwapBuffers(const gfx::Rect& damage); 53 void SwapBuffers(const gfx::Rect& damage);
54 void PageFlipComplete(); 54 void PageFlipComplete();
55 void Reshape(const gfx::Size& size, float scale_factor); 55 void Reshape(const gfx::Size& size, float scale_factor);
56 56
57 void RecreateBuffers(); 57 void RecreateBuffers();
58 58
59 unsigned int current_texture_id() const { 59 unsigned int current_texture_id() const {
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 DISPLAY_COMPOSITOR_EXPORT AllocatedSurface {
69 AllocatedSurface(BufferQueue* buffer_queue, 69 AllocatedSurface(BufferQueue* buffer_queue,
70 std::unique_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 std::unique_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;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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<std::unique_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 display_compositor
125 125
126 #endif // CONTENT_BROWSER_COMPOSITOR_BUFFER_QUEUE_H_ 126 #endif // COMPONENTS_DISPLAY_COMPOSITOR_BUFFER_QUEUE_H_
OLDNEW
« no previous file with comments | « components/display_compositor/OWNERS ('k') | components/display_compositor/buffer_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698