Chromium Code Reviews| Index: content/browser/gpu/gpu_surface_tracker.h |
| diff --git a/content/browser/gpu/gpu_surface_tracker.h b/content/browser/gpu/gpu_surface_tracker.h |
| index 039c9d2b69637972429fae75544258165cbc5ca9..e80200d8de9b101b0b6a24667aedf2cc0543f597 100644 |
| --- a/content/browser/gpu/gpu_surface_tracker.h |
| +++ b/content/browser/gpu/gpu_surface_tracker.h |
| @@ -6,13 +6,17 @@ |
| #define CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ |
| #include <map> |
| +#include <vector> |
| #include "base/basictypes.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/memory/singleton.h" |
| #include "base/synchronization/lock.h" |
| #include "ui/gfx/native_widget_types.h" |
| #include "ui/gfx/size.h" |
| +class GpuSurfaceReader; |
| + |
| // This class is responsible for managing rendering surfaces exposed to the |
| // GPU process. Every surface gets registered to this class, and gets an ID. |
| // All calls to and from the GPU process, with the exception of |
| @@ -24,6 +28,13 @@ |
| // it is unamibiguously identified. |
| class GpuSurfaceTracker { |
| public: |
| + struct SurfaceInfo { |
|
apatrick_chromium
2012/03/07 20:39:37
If it weren't for GpuSurfaceReader, this could rem
mazda
2012/03/08 13:14:28
Done.
|
| + int renderer_id; |
| + int render_widget_id; |
| + gfx::AcceleratedWidget native_widget; |
| + gfx::GLSurfaceHandle handle; |
| + }; |
| + |
| // Gets the global instance of the surface tracker. |
| static GpuSurfaceTracker* Get() { return GetInstance(); } |
| @@ -58,6 +69,12 @@ class GpuSurfaceTracker { |
| // Note: This is an O(log N) lookup. |
| gfx::GLSurfaceHandle GetSurfaceHandle(int surface_id); |
| + // Copies the image data of the the given surface to |out|. The image data |
| + // is transformed so that it fits in |size|. |
| + bool CopySurface(int surface_id, |
| + const gfx::Size& size, |
| + std::vector<unsigned char>* out); |
| + |
| #if defined(OS_WIN) && !defined(USE_AURA) |
| // This is a member of GpuSurfaceTracker because it holds the lock for its |
| // duration. This prevents the AcceleratedSurface that it posts to from being |
| @@ -76,12 +93,6 @@ class GpuSurfaceTracker { |
| static GpuSurfaceTracker* GetInstance(); |
| private: |
| - struct SurfaceInfo { |
| - int renderer_id; |
| - int render_widget_id; |
| - gfx::AcceleratedWidget native_widget; |
| - gfx::GLSurfaceHandle handle; |
| - }; |
| typedef std::map<int, SurfaceInfo> SurfaceMap; |
| friend struct DefaultSingletonTraits<GpuSurfaceTracker>; |
| @@ -92,6 +103,7 @@ class GpuSurfaceTracker { |
| base::Lock lock_; |
| SurfaceMap surface_map_; |
| int next_surface_id_; |
| + scoped_ptr<GpuSurfaceReader> reader_; |
| DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); |
| }; |