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

Unified Diff: content/browser/compositor/buffered_output_surface.h

Issue 516663003: Surfaceless OutputSurface implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: content/browser/compositor/buffered_output_surface.h
diff --git a/content/browser/compositor/buffered_output_surface.h b/content/browser/compositor/buffered_output_surface.h
new file mode 100644
index 0000000000000000000000000000000000000000..4122a09c38e5bcc4968a082568ae0d0780316b34
--- /dev/null
+++ b/content/browser/compositor/buffered_output_surface.h
@@ -0,0 +1,61 @@
+// 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 <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 BufferedOutputSurface {
+ public:
+ BufferedOutputSurface(scoped_refptr<cc::ContextProvider> context_provider,
+ unsigned int internalformat);
+ ~BufferedOutputSurface();
+
+ void Initialize();
+
+ void BindFramebuffer();
+ void SwapBuffers();
+ void PageFlipComplete();
+ void Reshape(const gfx::Size& size, float scale_factor);
+
+ unsigned int tex_id() { return tex_id_; }
+
+ private:
+ friend class BufferedOutputSurfaceTest;
+
+ void FreeAllSurfaces();
+
+ void FreeSurface(unsigned int* surface);
+
+ // Return a surface, available to be drawn into.
+ unsigned int GetNextSurface();
+
+ gfx::Size size_;
+ scoped_refptr<cc::ContextProvider> context_provider_;
+ unsigned int fbo_, depth_rb_, tex_id_;
+ unsigned int internalformat_;
+ unsigned int current_surface_; // This surface is currently bound.
+ unsigned int last_surface_; // This surface has been sent to the hardware.
+ std::vector<unsigned int> available_surfaces_; // These are free for use.
+ unsigned int in_flight_surface_; // This surface is waiting for the callback.
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_COMPOSITOR_BUFFERED_OUTPUT_SURFACE_H_

Powered by Google App Engine
This is Rietveld 408576698