Chromium Code Reviews| 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> |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 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; |
| 40 | 40 |
| 41 #if defined(OS_ANDROID) | 41 #if defined(OS_ANDROID) |
| 42 // Register |j_surface| with ID |surface_id|, which must be not in use. | |
| 42 void RegisterViewSurface(int surface_id, jobject j_surface); | 43 void RegisterViewSurface(int surface_id, jobject j_surface); |
| 44 | |
| 45 // Register |j_surface| with a new surface ID and return the ID. | |
| 46 int RegisterViewSurface(jobject j_surface); | |
|
boliu
2017/03/30 22:42:02
err, I asked this to be refactored when this code
liberato (no reviews please)
2017/04/04 17:49:28
sorry about that. will refactor per our offline d
boliu
2017/04/04 23:53:21
Oh I originally asked someone else, not you
Thank
| |
| 47 | |
| 43 void UnregisterViewSurface(int surface_id); | 48 void UnregisterViewSurface(int surface_id); |
| 44 gl::ScopedJavaSurface AcquireJavaSurface(int surface_id) override; | 49 gl::ScopedJavaSurface AcquireJavaSurface(int surface_id) override; |
| 45 #endif | 50 #endif |
| 46 | 51 |
| 47 // Gets the global instance of the surface tracker. | 52 // Gets the global instance of the surface tracker. |
| 48 static GpuSurfaceTracker* Get() { return GetInstance(); } | 53 static GpuSurfaceTracker* Get() { return GetInstance(); } |
| 49 | 54 |
| 50 // Adds a surface for a native widget. Returns the surface ID. | 55 // Adds a surface for a native widget. Returns the surface ID. |
| 51 int AddSurfaceForNativeWidget(gfx::AcceleratedWidget widget); | 56 int AddSurfaceForNativeWidget(gfx::AcceleratedWidget widget); |
| 52 | 57 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 81 SurfaceViewMap surface_view_map_; | 86 SurfaceViewMap surface_view_map_; |
| 82 #endif | 87 #endif |
| 83 | 88 |
| 84 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); | 89 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); |
| 85 }; | 90 }; |
| 86 | 91 |
| 87 } // namespace ui | 92 } // namespace ui |
| 88 | 93 |
| 89 #endif // GPU_IPC_COMMON_GPU_SURFACE_TRACKER_H_ | 94 #endif // GPU_IPC_COMMON_GPU_SURFACE_TRACKER_H_ |
| 90 | 95 |
| OLD | NEW |