OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/gpu/client/gpu_channel_host.h" | 5 #include "content/common/gpu/client/gpu_channel_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 factory, gpu_host_id, client_id, gpu_info); | 44 factory, gpu_host_id, client_id, gpu_info); |
45 host->Connect(channel_handle); | 45 host->Connect(channel_handle); |
46 return host; | 46 return host; |
47 } | 47 } |
48 | 48 |
49 // static | 49 // static |
50 bool GpuChannelHost::IsValidGpuMemoryBuffer( | 50 bool GpuChannelHost::IsValidGpuMemoryBuffer( |
51 gfx::GpuMemoryBufferHandle handle) { | 51 gfx::GpuMemoryBufferHandle handle) { |
52 switch (handle.type) { | 52 switch (handle.type) { |
53 case gfx::SHARED_MEMORY_BUFFER: | 53 case gfx::SHARED_MEMORY_BUFFER: |
| 54 #if defined(OS_MACOSX) |
| 55 case gfx::IO_SURFACE_BUFFER: |
| 56 #endif |
54 return true; | 57 return true; |
55 default: | 58 default: |
56 return false; | 59 return false; |
57 } | 60 } |
58 } | 61 } |
59 | 62 |
60 GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory, | 63 GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory, |
61 int gpu_host_id, | 64 int gpu_host_id, |
62 int client_id, | 65 int client_id, |
63 const gpu::GPUInfo& gpu_info) | 66 const gpu::GPUInfo& gpu_info) |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 302 |
300 gfx::GpuMemoryBufferHandle GpuChannelHost::ShareGpuMemoryBufferToGpuProcess( | 303 gfx::GpuMemoryBufferHandle GpuChannelHost::ShareGpuMemoryBufferToGpuProcess( |
301 gfx::GpuMemoryBufferHandle source_handle) { | 304 gfx::GpuMemoryBufferHandle source_handle) { |
302 switch (source_handle.type) { | 305 switch (source_handle.type) { |
303 case gfx::SHARED_MEMORY_BUFFER: { | 306 case gfx::SHARED_MEMORY_BUFFER: { |
304 gfx::GpuMemoryBufferHandle handle; | 307 gfx::GpuMemoryBufferHandle handle; |
305 handle.type = gfx::SHARED_MEMORY_BUFFER; | 308 handle.type = gfx::SHARED_MEMORY_BUFFER; |
306 handle.handle = ShareToGpuProcess(source_handle.handle); | 309 handle.handle = ShareToGpuProcess(source_handle.handle); |
307 return handle; | 310 return handle; |
308 } | 311 } |
| 312 #if defined(OS_MACOSX) |
| 313 case gfx::IO_SURFACE_BUFFER: |
| 314 return source_handle; |
| 315 #endif |
309 default: | 316 default: |
310 NOTREACHED(); | 317 NOTREACHED(); |
311 return gfx::GpuMemoryBufferHandle(); | 318 return gfx::GpuMemoryBufferHandle(); |
312 } | 319 } |
313 } | 320 } |
314 | 321 |
315 int32 GpuChannelHost::ReserveGpuMemoryBufferId() { | 322 int32 GpuChannelHost::ReserveGpuMemoryBufferId() { |
316 return next_gpu_memory_buffer_id_.GetNext(); | 323 return next_gpu_memory_buffer_id_.GetNext(); |
317 } | 324 } |
318 | 325 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 AutoLock lock(lock_); | 446 AutoLock lock(lock_); |
440 DCHECK_LE(names.size(), requested_mailboxes_); | 447 DCHECK_LE(names.size(), requested_mailboxes_); |
441 requested_mailboxes_ -= names.size(); | 448 requested_mailboxes_ -= names.size(); |
442 mailbox_name_pool_.insert(mailbox_name_pool_.end(), | 449 mailbox_name_pool_.insert(mailbox_name_pool_.end(), |
443 names.begin(), | 450 names.begin(), |
444 names.end()); | 451 names.end()); |
445 } | 452 } |
446 | 453 |
447 | 454 |
448 } // namespace content | 455 } // namespace content |
OLD | NEW |