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

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

Issue 516663003: Surfaceless OutputSurface implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests for new bind/init order 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 | « cc/test/test_web_graphics_context_3d.h ('k') | content/browser/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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_COMPOSITOR_BUFFERED_OUTPUT_SURFACE_H_
6 #define CONTENT_BROWSER_COMPOSITOR_BUFFERED_OUTPUT_SURFACE_H_
7
8 #include <queue>
9 #include <vector>
10
11 #include "base/memory/ref_counted.h"
12 #include "content/common/content_export.h"
13 #include "ui/gfx/size.h"
14
15 namespace cc {
16 class ContextProvider;
17 }
18
19 namespace content {
20
21 // Provides a surface that manages its own uffers, backed by
22 // CreateImageCHROMIUM. Double/triple buffering is implemented
23 // internally. Doublebuffering occurs if PageFlipComplete is called before
24 // the next BindFramebuffer call, otherwise it creates extra buffers.
25 class CONTENT_EXPORT BufferQueue {
26 public:
27 BufferQueue(scoped_refptr<cc::ContextProvider> context_provider,
28 unsigned int internalformat);
29 ~BufferQueue();
30
31 bool Initialize();
32
33 void BindFramebuffer();
34 void SwapBuffers();
35 void PageFlipComplete();
36 void Reshape(const gfx::Size& size, float scale_factor);
37
38 unsigned int current_texture_id() { return current_surface_.texture; }
39
40 private:
41 friend class BufferQueueTest;
42 struct AllocatedSurface {
43 AllocatedSurface() : texture(0), image(0) {}
44 AllocatedSurface(unsigned int texture, unsigned int image)
45 : texture(texture), image(image) {}
46 unsigned int texture;
47 unsigned int image;
48 };
49
50 void FreeAllSurfaces();
51
52 void FreeSurface(AllocatedSurface* surface);
53
54 // Return a surface, available to be drawn into.
55 AllocatedSurface GetNextSurface();
56
57 gfx::Size size_;
58 scoped_refptr<cc::ContextProvider> context_provider_;
59 unsigned int fbo_;
60 size_t allocated_count_;
61 unsigned int internalformat_;
62 AllocatedSurface current_surface_; // This surface is currently bound.
63 std::vector<AllocatedSurface> available_surfaces_; // These are free for use.
64 std::queue<AllocatedSurface> in_flight_surfaces_;
65
66 DISALLOW_COPY_AND_ASSIGN(BufferQueue);
67 };
68
69 } // namespace content
70
71 #endif // CONTENT_BROWSER_COMPOSITOR_BUFFERED_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/test/test_web_graphics_context_3d.h ('k') | content/browser/compositor/buffer_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698