| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ | 6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 base::ProcessHandle child_process_handle, | 86 base::ProcessHandle child_process_handle, |
| 87 int child_client_id, | 87 int child_client_id, |
| 88 const AllocationCallback& callback); | 88 const AllocationCallback& callback); |
| 89 void ChildProcessDeletedGpuMemoryBuffer( | 89 void ChildProcessDeletedGpuMemoryBuffer( |
| 90 gfx::GpuMemoryBufferId id, | 90 gfx::GpuMemoryBufferId id, |
| 91 base::ProcessHandle child_process_handle, | 91 base::ProcessHandle child_process_handle, |
| 92 int child_client_id, | 92 int child_client_id, |
| 93 uint32 sync_point); | 93 uint32 sync_point); |
| 94 void ProcessRemoved(base::ProcessHandle process_handle, int client_id); | 94 void ProcessRemoved(base::ProcessHandle process_handle, int client_id); |
| 95 | 95 |
| 96 bool IsNativeGpuMemoryBufferConfiguration(gfx::BufferFormat format, |
| 97 gfx::BufferUsage usage) const; |
| 98 |
| 96 private: | 99 private: |
| 97 struct BufferInfo { | 100 struct BufferInfo { |
| 98 BufferInfo() | 101 BufferInfo() |
| 99 : type(gfx::EMPTY_BUFFER), | 102 : type(gfx::EMPTY_BUFFER), |
| 100 format(gfx::BufferFormat::RGBA_8888), | 103 format(gfx::BufferFormat::RGBA_8888), |
| 101 usage(gfx::BufferUsage::GPU_READ), | 104 usage(gfx::BufferUsage::GPU_READ), |
| 102 gpu_host_id(0) {} | 105 gpu_host_id(0) {} |
| 103 BufferInfo(const gfx::Size& size, | 106 BufferInfo(const gfx::Size& size, |
| 104 gfx::GpuMemoryBufferType type, | 107 gfx::GpuMemoryBufferType type, |
| 105 gfx::BufferFormat format, | 108 gfx::BufferFormat format, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 128 gfx::BufferUsage usage, | 131 gfx::BufferUsage usage, |
| 129 int client_id, | 132 int client_id, |
| 130 const CreateCallback& callback)>; | 133 const CreateCallback& callback)>; |
| 131 | 134 |
| 132 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForSurface( | 135 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForSurface( |
| 133 const gfx::Size& size, | 136 const gfx::Size& size, |
| 134 gfx::BufferFormat format, | 137 gfx::BufferFormat format, |
| 135 gfx::BufferUsage usage, | 138 gfx::BufferUsage usage, |
| 136 int32 surface_id); | 139 int32 surface_id); |
| 137 | 140 |
| 138 bool IsNativeGpuMemoryBufferConfiguration(gfx::BufferFormat format, | |
| 139 gfx::BufferUsage usage) const; | |
| 140 | |
| 141 // Functions that handle synchronous buffer creation requests. | 141 // Functions that handle synchronous buffer creation requests. |
| 142 void HandleCreateGpuMemoryBufferOnIO(CreateGpuMemoryBufferRequest* request); | 142 void HandleCreateGpuMemoryBufferOnIO(CreateGpuMemoryBufferRequest* request); |
| 143 void HandleCreateGpuMemoryBufferFromHandleOnIO( | 143 void HandleCreateGpuMemoryBufferFromHandleOnIO( |
| 144 CreateGpuMemoryBufferFromHandleRequest* request); | 144 CreateGpuMemoryBufferFromHandleRequest* request); |
| 145 void HandleGpuMemoryBufferCreatedOnIO( | 145 void HandleGpuMemoryBufferCreatedOnIO( |
| 146 CreateGpuMemoryBufferRequest* request, | 146 CreateGpuMemoryBufferRequest* request, |
| 147 const gfx::GpuMemoryBufferHandle& handle); | 147 const gfx::GpuMemoryBufferHandle& handle); |
| 148 | 148 |
| 149 // Functions that implement asynchronous buffer creation. | 149 // Functions that implement asynchronous buffer creation. |
| 150 void CreateGpuMemoryBufferOnIO(const CreateDelegate& create_delegate, | 150 void CreateGpuMemoryBufferOnIO(const CreateDelegate& create_delegate, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 180 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; | 180 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; |
| 181 using ClientMap = base::hash_map<int, BufferMap>; | 181 using ClientMap = base::hash_map<int, BufferMap>; |
| 182 ClientMap clients_; | 182 ClientMap clients_; |
| 183 | 183 |
| 184 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); | 184 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 } // namespace content | 187 } // namespace content |
| 188 | 188 |
| 189 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ | 189 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ |
| OLD | NEW |