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

Side by Side Diff: content/child/child_gpu_memory_buffer_manager.cc

Issue 685983005: gpu: Associate all GpuMemoryBuffers with unique IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more ozone build fix Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
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 #include "content/child/child_gpu_memory_buffer_manager.h" 5 #include "content/child/child_gpu_memory_buffer_manager.h"
6 6
7 #include "content/child/child_thread.h" 7 #include "content/child/child_thread.h"
8 #include "content/common/child_process_messages.h" 8 #include "content/common/child_process_messages.h"
9 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" 9 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
10 10
11 namespace content { 11 namespace content {
12 namespace { 12 namespace {
13 13
14 void DeletedGpuMemoryBuffer(ThreadSafeSender* sender, 14 void DeletedGpuMemoryBuffer(ThreadSafeSender* sender,
15 gfx::GpuMemoryBufferType type, 15 gfx::GpuMemoryBufferType type,
16 const gfx::GpuMemoryBufferId& id, 16 gfx::GpuMemoryBufferId id,
17 uint32 sync_point) { 17 uint32 sync_point) {
18 TRACE_EVENT0("renderer", 18 TRACE_EVENT0("renderer",
19 "ChildGpuMemoryBufferManager::DeletedGpuMemoryBuffer"); 19 "ChildGpuMemoryBufferManager::DeletedGpuMemoryBuffer");
20 sender->Send( 20 sender->Send(
21 new ChildProcessHostMsg_DeletedGpuMemoryBuffer(type, id, sync_point)); 21 new ChildProcessHostMsg_DeletedGpuMemoryBuffer(type, id, sync_point));
22 } 22 }
23 23
24 } // namespace 24 } // namespace
25 25
26 ChildGpuMemoryBufferManager::ChildGpuMemoryBufferManager( 26 ChildGpuMemoryBufferManager::ChildGpuMemoryBufferManager(
(...skipping 20 matching lines...) Expand all
47 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( 47 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer(
48 size.width(), size.height(), format, usage, &handle); 48 size.width(), size.height(), format, usage, &handle);
49 bool success = sender_->Send(message); 49 bool success = sender_->Send(message);
50 if (!success) 50 if (!success)
51 return scoped_ptr<gfx::GpuMemoryBuffer>(); 51 return scoped_ptr<gfx::GpuMemoryBuffer>();
52 52
53 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( 53 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle(
54 handle, 54 handle,
55 size, 55 size,
56 format, 56 format,
57 base::Bind( 57 base::Bind(&DeletedGpuMemoryBuffer, sender_, handle.type, handle.id)));
58 &DeletedGpuMemoryBuffer, sender_, handle.type, handle.global_id)));
59 if (!buffer) { 58 if (!buffer) {
60 sender_->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer( 59 sender_->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer(
61 handle.type, handle.global_id, 0)); 60 handle.type, handle.id, 0));
62 return scoped_ptr<gfx::GpuMemoryBuffer>(); 61 return scoped_ptr<gfx::GpuMemoryBuffer>();
63 } 62 }
64 63
65 return buffer.Pass(); 64 return buffer.Pass();
66 } 65 }
67 66
68 gfx::GpuMemoryBuffer* 67 gfx::GpuMemoryBuffer*
69 ChildGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer( 68 ChildGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer(
70 ClientBuffer buffer) { 69 ClientBuffer buffer) {
71 return GpuMemoryBufferImpl::FromClientBuffer(buffer); 70 return GpuMemoryBufferImpl::FromClientBuffer(buffer);
72 } 71 }
73 72
74 void ChildGpuMemoryBufferManager::SetDestructionSyncPoint( 73 void ChildGpuMemoryBufferManager::SetDestructionSyncPoint(
75 gfx::GpuMemoryBuffer* buffer, 74 gfx::GpuMemoryBuffer* buffer,
76 uint32 sync_point) { 75 uint32 sync_point) {
77 static_cast<GpuMemoryBufferImpl*>(buffer) 76 static_cast<GpuMemoryBufferImpl*>(buffer)
78 ->set_destruction_sync_point(sync_point); 77 ->set_destruction_sync_point(sync_point);
79 } 78 }
80 79
81 } // namespace content 80 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | content/common/android/surface_texture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698