| 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // This class is used on Android and Mac, and is responsible for tracking native | 22 // This class is used on Android and Mac, and is responsible for tracking native |
| 23 // window surfaces exposed to the GPU process. Every surface gets registered to | 23 // window surfaces exposed to the GPU process. Every surface gets registered to |
| 24 // this class, and gets a handle. The handle can be passed to | 24 // this class, and gets a handle. The handle can be passed to |
| 25 // GpuChannelHost::CreateCommandBuffer or to | 25 // GpuChannelHost::CreateCommandBuffer or to |
| 26 // GpuMemoryBufferManager::AllocateGpuMemoryBuffer. | 26 // GpuMemoryBufferManager::AllocateGpuMemoryBuffer. |
| 27 // On Android, the handle is used in the GPU process to get a reference to the | 27 // On Android, the handle is used in the GPU process to get a reference to the |
| 28 // ANativeWindow, using GpuSurfaceLookup (implemented by | 28 // ANativeWindow, using GpuSurfaceLookup (implemented by |
| 29 // SurfaceTextureManagerImpl). | 29 // SurfaceTextureManagerImpl). |
| 30 // On Mac, the handle just passes through the GPU process, and is sent back via | 30 // On Mac, the handle just passes through the GPU process, and is sent back via |
| 31 // GpuHostMsg_AcceleratedSurfaceBuffersSwapped to reference the surface. | 31 // GpuCommandBufferMsg_SwapBuffersCompleted to reference the surface. |
| 32 // This class is thread safe. | 32 // This class is thread safe. |
| 33 class CONTENT_EXPORT GpuSurfaceTracker : public gpu::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_handle. | 36 // Returns the native widget associated with a given surface_handle. |
| 37 // On Android, this adds a reference on the ANativeWindow. | 37 // On Android, this adds a reference on the ANativeWindow. |
| 38 gfx::AcceleratedWidget AcquireNativeWidget( | 38 gfx::AcceleratedWidget AcquireNativeWidget( |
| 39 gpu::SurfaceHandle surface_handle) override; | 39 gpu::SurfaceHandle surface_handle) override; |
| 40 | 40 |
| 41 #if defined(OS_ANDROID) | 41 #if defined(OS_ANDROID) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 69 base::Lock lock_; | 69 base::Lock lock_; |
| 70 SurfaceMap surface_map_; | 70 SurfaceMap surface_map_; |
| 71 int next_surface_handle_; | 71 int next_surface_handle_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); | 73 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace content | 76 } // namespace content |
| 77 | 77 |
| 78 #endif // CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ | 78 #endif // CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ |
| OLD | NEW |