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

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

Issue 1272393002: Add initial GLImage tracing + stubs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@trackpools
Patch Set: move generic_shared_memory_id.* 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 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/common/child_process_messages.h" 7 #include "content/common/child_process_messages.h"
8 #include "content/common/generic_shared_memory_id_generator.h"
8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" 9 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
9 10
10 namespace content { 11 namespace content {
11 namespace { 12 namespace {
12 13
13 void DeletedGpuMemoryBuffer(ThreadSafeSender* sender, 14 void DeletedGpuMemoryBuffer(ThreadSafeSender* sender,
14 gfx::GpuMemoryBufferId id, 15 gfx::GpuMemoryBufferId id,
15 uint32 sync_point) { 16 uint32 sync_point) {
16 TRACE_EVENT0("renderer", 17 TRACE_EVENT0("renderer",
17 "ChildGpuMemoryBufferManager::DeletedGpuMemoryBuffer"); 18 "ChildGpuMemoryBufferManager::DeletedGpuMemoryBuffer");
(...skipping 16 matching lines...) Expand all
34 gfx::BufferUsage usage) { 35 gfx::BufferUsage usage) {
35 TRACE_EVENT2("renderer", 36 TRACE_EVENT2("renderer",
36 "ChildGpuMemoryBufferManager::AllocateGpuMemoryBuffer", 37 "ChildGpuMemoryBufferManager::AllocateGpuMemoryBuffer",
37 "width", 38 "width",
38 size.width(), 39 size.width(),
39 "height", 40 "height",
40 size.height()); 41 size.height());
41 42
42 gfx::GpuMemoryBufferHandle handle; 43 gfx::GpuMemoryBufferHandle handle;
43 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( 44 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer(
44 size.width(), size.height(), format, usage, &handle); 45 content::GetNextGenericSharedMemoryId(), size.width(), size.height(),
46 format, usage, &handle);
45 bool success = sender_->Send(message); 47 bool success = sender_->Send(message);
46 if (!success || handle.is_null()) 48 if (!success || handle.is_null())
47 return nullptr; 49 return nullptr;
48 50
49 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( 51 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle(
50 handle, size, format, usage, 52 handle, size, format, usage,
51 base::Bind(&DeletedGpuMemoryBuffer, sender_, handle.id))); 53 base::Bind(&DeletedGpuMemoryBuffer, sender_, handle.id)));
52 if (!buffer) { 54 if (!buffer) {
53 sender_->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer(handle.id, 0)); 55 sender_->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer(handle.id, 0));
54 return nullptr; 56 return nullptr;
55 } 57 }
56 58
57 return buffer.Pass(); 59 return buffer.Pass();
58 } 60 }
59 61
60 gfx::GpuMemoryBuffer* 62 gfx::GpuMemoryBuffer*
61 ChildGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer( 63 ChildGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer(
62 ClientBuffer buffer) { 64 ClientBuffer buffer) {
63 return GpuMemoryBufferImpl::FromClientBuffer(buffer); 65 return GpuMemoryBufferImpl::FromClientBuffer(buffer);
64 } 66 }
65 67
66 void ChildGpuMemoryBufferManager::SetDestructionSyncPoint( 68 void ChildGpuMemoryBufferManager::SetDestructionSyncPoint(
67 gfx::GpuMemoryBuffer* buffer, 69 gfx::GpuMemoryBuffer* buffer,
68 uint32 sync_point) { 70 uint32 sync_point) {
69 static_cast<GpuMemoryBufferImpl*>(buffer) 71 static_cast<GpuMemoryBufferImpl*>(buffer)
70 ->set_destruction_sync_point(sync_point); 72 ->set_destruction_sync_point(sync_point);
71 } 73 }
72 74
73 } // namespace content 75 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | content/common/child_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698