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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/buffer_queue.h
diff --git a/content/browser/compositor/buffer_queue.h b/content/browser/compositor/buffer_queue.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b6185cadcceb5b2b2d1561c9ad45ef9ca168ed1
--- /dev/null
+++ b/content/browser/compositor/buffer_queue.h
@@ -0,0 +1,71 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_COMPOSITOR_BUFFERED_OUTPUT_SURFACE_H_
+#define CONTENT_BROWSER_COMPOSITOR_BUFFERED_OUTPUT_SURFACE_H_
+
+#include <queue>
+#include <vector>
+
+#include "base/memory/ref_counted.h"
+#include "content/common/content_export.h"
+#include "ui/gfx/size.h"
+
+namespace cc {
+class ContextProvider;
+}
+
+namespace content {
+
+// Provides a surface that manages its own uffers, backed by
+// CreateImageCHROMIUM. Double/triple buffering is implemented
+// internally. Doublebuffering occurs if PageFlipComplete is called before
+// the next BindFramebuffer call, otherwise it creates extra buffers.
+class CONTENT_EXPORT BufferQueue {
+ public:
+ BufferQueue(scoped_refptr<cc::ContextProvider> context_provider,
+ unsigned int internalformat);
+ ~BufferQueue();
+
+ bool Initialize();
+
+ void BindFramebuffer();
+ void SwapBuffers();
+ void PageFlipComplete();
+ void Reshape(const gfx::Size& size, float scale_factor);
+
+ unsigned int current_texture_id() { return current_surface_.texture; }
+
+ private:
+ friend class BufferQueueTest;
+ struct AllocatedSurface {
+ AllocatedSurface() : texture(0), image(0) {}
+ AllocatedSurface(unsigned int texture, unsigned int image)
+ : texture(texture), image(image) {}
+ unsigned int texture;
+ unsigned int image;
+ };
+
+ void FreeAllSurfaces();
+
+ void FreeSurface(AllocatedSurface* surface);
+
+ // Return a surface, available to be drawn into.
+ AllocatedSurface GetNextSurface();
+
+ gfx::Size size_;
+ scoped_refptr<cc::ContextProvider> context_provider_;
+ unsigned int fbo_;
+ size_t allocated_count_;
+ unsigned int internalformat_;
+ AllocatedSurface current_surface_; // This surface is currently bound.
+ std::vector<AllocatedSurface> available_surfaces_; // These are free for use.
+ std::queue<AllocatedSurface> in_flight_surfaces_;
+
+ DISALLOW_COPY_AND_ASSIGN(BufferQueue);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_COMPOSITOR_BUFFERED_OUTPUT_SURFACE_H_
« 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