| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ |
| 6 #define CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/common/gpu/gpu_surface_lookup.h" | 17 #include "gpu/ipc/common/gpu_surface_lookup.h" |
| 18 #include "gpu/ipc/common/surface_handle.h" | 18 #include "gpu/ipc/common/surface_handle.h" |
| 19 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
| 20 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| 23 | 23 |
| 24 // This class is responsible for managing rendering surfaces exposed to the | 24 // This class is responsible for managing rendering surfaces exposed to the |
| 25 // GPU process. Every surface gets registered to this class, and gets an ID. | 25 // GPU process. Every surface gets registered to this class, and gets an ID. |
| 26 // All calls to and from the GPU process, with the exception of | 26 // All calls to and from the GPU process, with the exception of |
| 27 // CreateViewCommandBuffer, refer to the rendering surface by its ID. | 27 // CreateViewCommandBuffer, refer to the rendering surface by its ID. |
| 28 // This class is thread safe. | 28 // This class is thread safe. |
| 29 // | 29 // |
| 30 // Note: The ID can exist before the actual native handle for the surface is | 30 // Note: The ID can exist before the actual native handle for the surface is |
| 31 // created, for example to allow giving a reference to it to a renderer, so that | 31 // created, for example to allow giving a reference to it to a renderer, so that |
| 32 // it is unamibiguously identified. | 32 // it is unamibiguously identified. |
| 33 class CONTENT_EXPORT GpuSurfaceTracker : public GpuSurfaceLookup { | 33 class CONTENT_EXPORT GpuSurfaceTracker : public gpu::GpuSurfaceLookup { |
| 34 public: | 34 public: |
| 35 // GpuSurfaceLookup implementation: | 35 // GpuSurfaceLookup implementation: |
| 36 // Returns the native widget associated with a given surface_id. | 36 // Returns the native widget associated with a given surface_id. |
| 37 gfx::AcceleratedWidget AcquireNativeWidget(int surface_id) override; | 37 gfx::AcceleratedWidget AcquireNativeWidget(int surface_id) override; |
| 38 | 38 |
| 39 // Gets the global instance of the surface tracker. | 39 // Gets the global instance of the surface tracker. |
| 40 static GpuSurfaceTracker* Get() { return GetInstance(); } | 40 static GpuSurfaceTracker* Get() { return GetInstance(); } |
| 41 | 41 |
| 42 // Adds a surface for a native widget. Returns the surface ID. | 42 // Adds a surface for a native widget. Returns the surface ID. |
| 43 int AddSurfaceForNativeWidget(gfx::AcceleratedWidget widget); | 43 int AddSurfaceForNativeWidget(gfx::AcceleratedWidget widget); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 67 base::Lock lock_; | 67 base::Lock lock_; |
| 68 SurfaceMap surface_map_; | 68 SurfaceMap surface_map_; |
| 69 int next_surface_id_; | 69 int next_surface_id_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); | 71 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace content | 74 } // namespace content |
| 75 | 75 |
| 76 #endif // CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ | 76 #endif // CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ |
| OLD | NEW |