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

Unified Diff: content/common/gpu/client/command_buffer_proxy_impl.cc

Issue 1412923004: Revert of Move gpu memory calculations to Compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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/common/gpu/client/command_buffer_proxy_impl.cc
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc
index 4ae3741fcd762886d572b06e2bd2f56ed776f027..c7af757e2742159049aff97a8044facd189623a5 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -72,6 +72,8 @@ bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message)
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed);
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage);
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation,
+ OnSetMemoryAllocation);
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalAck,
OnSignalAck);
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SwapBuffersCompleted,
@@ -130,6 +132,17 @@ void CommandBufferProxyImpl::OnConsoleMessage(
}
}
+void CommandBufferProxyImpl::SetMemoryAllocationChangedCallback(
+ const MemoryAllocationChangedCallback& callback) {
+ CheckLock();
+ if (last_state_.error != gpu::error::kNoError)
+ return;
+
+ memory_allocation_changed_callback_ = callback;
+ Send(new GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback(
+ route_id_, !memory_allocation_changed_callback_.is_null()));
+}
+
void CommandBufferProxyImpl::AddDeletionObserver(DeletionObserver* observer) {
scoped_ptr<base::AutoLock> lock;
if (lock_)
@@ -145,6 +158,12 @@ void CommandBufferProxyImpl::RemoveDeletionObserver(
deletion_observers_.RemoveObserver(observer);
}
+void CommandBufferProxyImpl::OnSetMemoryAllocation(
+ const gpu::MemoryAllocation& allocation) {
+ if (!memory_allocation_changed_callback_.is_null())
+ memory_allocation_changed_callback_.Run(allocation);
+}
+
void CommandBufferProxyImpl::OnSignalAck(uint32 id) {
SignalTaskMap::iterator it = signal_tasks_.find(id);
DCHECK(it != signal_tasks_.end());
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.h ('k') | content/common/gpu/client/context_provider_command_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698