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

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

Issue 634083002: gpu: Compositor management of GpuMemoryBuffer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cc-pre-chromium-image-refactor
Patch Set: mac build fix Created 6 years, 2 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
new file mode 100644
index 0000000000000000000000000000000000000000..e3be4778a177813f42c2b568841f80651e0cf689
--- /dev/null
+++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.h
@@ -0,0 +1,63 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_
+#define CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_
+
+#include "base/callback.h"
+#include "cc/resources/gpu_memory_buffer_manager.h"
+#include "content/common/content_export.h"
+
+namespace content {
+class GpuMemoryBufferImpl;
+
+class CONTENT_EXPORT BrowserGpuMemoryBufferManager
+ : public cc::GpuMemoryBufferManager {
+ public:
+ typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)>
+ AllocationCallback;
+
+ BrowserGpuMemoryBufferManager();
+ virtual ~BrowserGpuMemoryBufferManager();
+
+ static BrowserGpuMemoryBufferManager* current();
+
+ void set_gpu_client_id(int gpu_client_id) { gpu_client_id_ = gpu_client_id; }
+
+ // Overridden from cc::GpuMemoryBufferManager:
+ virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
+ const gfx::Size& size,
+ gfx::GpuMemoryBuffer::Format format,
+ gfx::GpuMemoryBuffer::Usage usage) override;
+ virtual gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer(
+ ClientBuffer buffer) override;
+
+ void AllocateGpuMemoryBufferForChildProcess(
+ const gfx::Size& size,
+ gfx::GpuMemoryBuffer::Format format,
+ gfx::GpuMemoryBuffer::Usage usage,
+ base::ProcessHandle child_process_handle,
+ int child_client_id,
+ const AllocationCallback& callback);
+ void ChildProcessDeletedGpuMemoryBuffer(
+ gfx::GpuMemoryBufferType type,
+ const gfx::GpuMemoryBufferId& id,
+ base::ProcessHandle child_process_handle);
+ void ProcessRemoved(base::ProcessHandle process_handle);
+
+ private:
+ struct AllocateGpuMemoryBufferRequest;
+
+ static void AllocateGpuMemoryBufferOnIO(
+ AllocateGpuMemoryBufferRequest* request);
+ static void GpuMemoryBufferCreatedOnIO(
+ AllocateGpuMemoryBufferRequest* request,
+ scoped_ptr<GpuMemoryBufferImpl> buffer);
+
+ int gpu_client_id_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698