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

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

Issue 1423843003: Make content::BufferQueue use scoped ptrs for AllocatedSurfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@surfaceless_only
Patch Set: Created 5 years, 2 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/buffer_queue.h
diff --git a/content/browser/compositor/buffer_queue.h b/content/browser/compositor/buffer_queue.h
index ad985b0f127bb38fd5236c3ce9e39d1cfbd0a21a..d9a3327f46a570e999ec6ceb26aed5ed61036129 100644
--- a/content/browser/compositor/buffer_queue.h
+++ b/content/browser/compositor/buffer_queue.h
@@ -8,9 +8,10 @@
#include <queue>
#include <vector>
-#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "cc/base/scoped_ptr_deque.h"
+#include "cc/base/scoped_ptr_vector.h"
#include "content/common/content_export.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -51,7 +52,7 @@ class CONTENT_EXPORT BufferQueue {
void RecreateBuffers();
- unsigned int current_texture_id() const { return current_surface_.texture; }
+ unsigned int current_texture_id() const { return current_surface_->texture; }
unsigned int fbo() const { return fbo_; }
private:
@@ -64,9 +65,7 @@ class CONTENT_EXPORT BufferQueue {
unsigned int image,
const gfx::Rect& rect);
~AllocatedSurface();
- // TODO(ccameron): Change this to be a scoped_ptr, and change all use of
- // AllocatedSurface to use scoped_ptr as well.
- linked_ptr<gfx::GpuMemoryBuffer> buffer;
+ scoped_ptr<gfx::GpuMemoryBuffer> buffer;
unsigned int texture;
unsigned int image;
gfx::Rect damage; // This is the damage for this frame from the previous.
@@ -74,7 +73,7 @@ class CONTENT_EXPORT BufferQueue {
void FreeAllSurfaces();
- void FreeSurface(AllocatedSurface* surface);
+ void FreeSurface(scoped_ptr<AllocatedSurface> surface);
// Copy everything that is in |copy_rect|, except for what is in
// |exclude_rect| from |source_texture| to |texture|.
@@ -86,9 +85,10 @@ class CONTENT_EXPORT BufferQueue {
void UpdateBufferDamage(const gfx::Rect& damage);
// Return a surface, available to be drawn into.
- AllocatedSurface GetNextSurface();
+ scoped_ptr<AllocatedSurface> GetNextSurface();
- AllocatedSurface RecreateBuffer(AllocatedSurface* surface);
+ scoped_ptr<AllocatedSurface> RecreateBuffer(
+ scoped_ptr<AllocatedSurface> surface);
gfx::Size size_;
scoped_refptr<cc::ContextProvider> context_provider_;
@@ -96,10 +96,14 @@ class CONTENT_EXPORT BufferQueue {
size_t allocated_count_;
unsigned int texture_target_;
unsigned int internal_format_;
- AllocatedSurface current_surface_; // This surface is currently bound.
- AllocatedSurface displayed_surface_; // The surface currently on the screen.
- std::vector<AllocatedSurface> available_surfaces_; // These are free for use.
- std::deque<AllocatedSurface> in_flight_surfaces_;
+ // This surface is currently bound.
+ scoped_ptr<AllocatedSurface> current_surface_;
+ // The surface currently on the screen.
+ scoped_ptr<AllocatedSurface> displayed_surface_;
+ // These are free for use.
+ cc::ScopedPtrVector<AllocatedSurface> available_surfaces_;
reveman 2015/10/27 17:03:44 could we use base::ScopedVector instead?
+ cc::ScopedPtrDeque<AllocatedSurface> in_flight_surfaces_;
+ size_t deleted_in_flight_surface_count_;
GLHelper* gl_helper_;
BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager_;
int surface_id_;
« no previous file with comments | « no previous file | content/browser/compositor/buffer_queue.cc » ('j') | content/browser/compositor/buffer_queue.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698