| 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 GPU_IPC_COMMON_GPU_SURFACE_TRACKER_H_ | 5 #ifndef GPU_IPC_COMMON_GPU_SURFACE_TRACKER_H_ |
| 6 #define GPU_IPC_COMMON_GPU_SURFACE_TRACKER_H_ | 6 #define GPU_IPC_COMMON_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/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "gpu/gpu_export.h" | 15 #include "gpu/gpu_export.h" |
| 16 #include "gpu/ipc/common/gpu_surface_lookup.h" | 16 #include "gpu/ipc/common/gpu_surface_lookup.h" |
| 17 #include "gpu/ipc/common/surface_handle.h" | 17 #include "gpu/ipc/common/surface_handle.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
| 19 | 19 |
| 20 namespace gpu { | 20 namespace gpu { |
| 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 // CommandBufferProxyImpl::Create or to | 25 // CommandBufferProxyImpl::Create or to |
| 26 // GpuMemoryBufferManager::CreateGpuMemoryBuffer. | 26 // GpuMemoryBufferManager::CreateGpuMemoryBuffer. |
| 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 // ChildProcessSurfaceManager). |
| 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 // GpuCommandBufferMsg_SwapBuffersCompleted 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 GPU_EXPORT GpuSurfaceTracker : public gpu::GpuSurfaceLookup { | 33 class GPU_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; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 SurfaceViewMap surface_view_map_; | 82 SurfaceViewMap surface_view_map_; |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); | 85 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace ui | 88 } // namespace ui |
| 89 | 89 |
| 90 #endif // GPU_IPC_COMMON_GPU_SURFACE_TRACKER_H_ | 90 #endif // GPU_IPC_COMMON_GPU_SURFACE_TRACKER_H_ |
| 91 | 91 |
| OLD | NEW |