Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1135)

Unified Diff: content/browser/gpu/browser_gpu_memory_buffer_manager.h

Issue 1280513002: Add GenericSharedMemoryId and use w/ GpuMemoryBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@trackpools
Patch Set: Avoid double map lookup Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/gpu/browser_gpu_memory_buffer_manager.h
diff --git a/content/browser/gpu/browser_gpu_memory_buffer_manager.h b/content/browser/gpu/browser_gpu_memory_buffer_manager.h
index b11faf870219478a21913d2c5387edfbadb1c66b..dadff8621c97b1bcf7a9fba9303d959aa164dcb0 100644
--- a/content/browser/gpu/browser_gpu_memory_buffer_manager.h
+++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.h
@@ -52,6 +52,7 @@ class CONTENT_EXPORT BrowserGpuMemoryBufferManager
int32 surface_id);
void AllocateGpuMemoryBufferForChildProcess(
+ gfx::GpuMemoryBufferId id,
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
@@ -90,6 +91,8 @@ class CONTENT_EXPORT BrowserGpuMemoryBufferManager
int gpu_host_id;
};
struct AllocateGpuMemoryBufferRequest;
+ using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>;
+ using ClientMap = base::hash_map<int, BufferMap>;
scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForSurface(
const gfx::Size& size,
@@ -124,6 +127,12 @@ class CONTENT_EXPORT BrowserGpuMemoryBufferManager
uint64_t ClientIdToTracingProcessId(int client_id) const;
+ // Helper that tries to add a new buffer to the map and returns false if not
+ // possible (because an element with the same id already existed).
+ bool TryAddNewBufferToMap(BufferMap& buffers,
+ int id,
+ const BufferInfo& buffer_info);
+
const gfx::GpuMemoryBufferType factory_type_;
const std::vector<GpuMemoryBufferFactory::Configuration>
supported_configurations_;
@@ -135,8 +144,6 @@ class CONTENT_EXPORT BrowserGpuMemoryBufferManager
// Stores info about buffers for all clients. This should only be accessed
// on the IO thread.
- using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>;
- using ClientMap = base::hash_map<int, BufferMap>;
ClientMap clients_;
DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager);

Powered by Google App Engine
This is Rietveld 408576698