| 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 <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // CreateViewCommandBuffer, refer to the rendering surface by its ID. | 22 // CreateViewCommandBuffer, refer to the rendering surface by its ID. |
| 23 // This class is thread safe. | 23 // This class is thread safe. |
| 24 // | 24 // |
| 25 // Note: The ID can exist before the actual native handle for the surface is | 25 // Note: The ID can exist before the actual native handle for the surface is |
| 26 // created, for example to allow giving a reference to it to a renderer, so that | 26 // created, for example to allow giving a reference to it to a renderer, so that |
| 27 // it is unamibiguously identified. | 27 // it is unamibiguously identified. |
| 28 class GpuSurfaceTracker : public GpuSurfaceLookup { | 28 class GpuSurfaceTracker : public GpuSurfaceLookup { |
| 29 public: | 29 public: |
| 30 // GpuSurfaceLookup implementation: | 30 // GpuSurfaceLookup implementation: |
| 31 // Returns the native widget associated with a given surface_id. | 31 // Returns the native widget associated with a given surface_id. |
| 32 virtual gfx::AcceleratedWidget GetNativeWidget(int surface_id) OVERRIDE; | 32 virtual gfx::AcceleratedWidget AcquireNativeWidget(int surface_id) OVERRIDE; |
| 33 | 33 |
| 34 // Gets the global instance of the surface tracker. | 34 // Gets the global instance of the surface tracker. |
| 35 static GpuSurfaceTracker* Get() { return GetInstance(); } | 35 static GpuSurfaceTracker* Get() { return GetInstance(); } |
| 36 | 36 |
| 37 // Adds a surface for a given RenderWidgetHost. |renderer_id| is the renderer | 37 // Adds a surface for a given RenderWidgetHost. |renderer_id| is the renderer |
| 38 // process ID, |render_widget_id| is the RenderWidgetHost route id within that | 38 // process ID, |render_widget_id| is the RenderWidgetHost route id within that |
| 39 // renderer. Returns the surface ID. | 39 // renderer. Returns the surface ID. |
| 40 int AddSurfaceForRenderer(int renderer_id, int render_widget_id); | 40 int AddSurfaceForRenderer(int renderer_id, int render_widget_id); |
| 41 | 41 |
| 42 // Looks up a surface for a given RenderWidgetHost. Returns the surface | 42 // Looks up a surface for a given RenderWidgetHost. Returns the surface |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 base::Lock lock_; | 96 base::Lock lock_; |
| 97 SurfaceMap surface_map_; | 97 SurfaceMap surface_map_; |
| 98 int next_surface_id_; | 98 int next_surface_id_; |
| 99 | 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); | 100 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 } // namespace content | 103 } // namespace content |
| 104 | 104 |
| 105 #endif // CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ | 105 #endif // CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ |
| OLD | NEW |