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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 factory, gpu_host_id, gpu_info); | 43 factory, gpu_host_id, gpu_info); |
44 host->Connect(channel_handle); | 44 host->Connect(channel_handle); |
45 return host; | 45 return host; |
46 } | 46 } |
47 | 47 |
48 // static | 48 // static |
49 bool GpuChannelHost::IsValidGpuMemoryBuffer( | 49 bool GpuChannelHost::IsValidGpuMemoryBuffer( |
50 gfx::GpuMemoryBufferHandle handle) { | 50 gfx::GpuMemoryBufferHandle handle) { |
51 switch (handle.type) { | 51 switch (handle.type) { |
52 case gfx::SHARED_MEMORY_BUFFER: | 52 case gfx::SHARED_MEMORY_BUFFER: |
| 53 #if defined(OS_MACOSX) |
| 54 case gfx::IO_SURFACE_BUFFER: |
| 55 #endif |
53 return true; | 56 return true; |
54 default: | 57 default: |
55 return false; | 58 return false; |
56 } | 59 } |
57 } | 60 } |
58 | 61 |
59 GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory, | 62 GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory, |
60 int gpu_host_id, | 63 int gpu_host_id, |
61 const gpu::GPUInfo& gpu_info) | 64 const gpu::GPUInfo& gpu_info) |
62 : factory_(factory), | 65 : factory_(factory), |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 299 |
297 gfx::GpuMemoryBufferHandle GpuChannelHost::ShareGpuMemoryBufferToGpuProcess( | 300 gfx::GpuMemoryBufferHandle GpuChannelHost::ShareGpuMemoryBufferToGpuProcess( |
298 gfx::GpuMemoryBufferHandle source_handle) { | 301 gfx::GpuMemoryBufferHandle source_handle) { |
299 switch (source_handle.type) { | 302 switch (source_handle.type) { |
300 case gfx::SHARED_MEMORY_BUFFER: { | 303 case gfx::SHARED_MEMORY_BUFFER: { |
301 gfx::GpuMemoryBufferHandle handle; | 304 gfx::GpuMemoryBufferHandle handle; |
302 handle.type = gfx::SHARED_MEMORY_BUFFER; | 305 handle.type = gfx::SHARED_MEMORY_BUFFER; |
303 handle.handle = ShareToGpuProcess(source_handle.handle); | 306 handle.handle = ShareToGpuProcess(source_handle.handle); |
304 return handle; | 307 return handle; |
305 } | 308 } |
| 309 #if defined(OS_MACOSX) |
| 310 case gfx::IO_SURFACE_BUFFER: |
| 311 return source_handle; |
| 312 #endif |
306 default: | 313 default: |
307 NOTREACHED(); | 314 NOTREACHED(); |
308 return gfx::GpuMemoryBufferHandle(); | 315 return gfx::GpuMemoryBufferHandle(); |
309 } | 316 } |
310 } | 317 } |
311 | 318 |
312 int32 GpuChannelHost::ReserveGpuMemoryBufferId() { | 319 int32 GpuChannelHost::ReserveGpuMemoryBufferId() { |
313 return next_gpu_memory_buffer_id_.GetNext(); | 320 return next_gpu_memory_buffer_id_.GetNext(); |
314 } | 321 } |
315 | 322 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 AutoLock lock(lock_); | 443 AutoLock lock(lock_); |
437 DCHECK_LE(names.size(), requested_mailboxes_); | 444 DCHECK_LE(names.size(), requested_mailboxes_); |
438 requested_mailboxes_ -= names.size(); | 445 requested_mailboxes_ -= names.size(); |
439 mailbox_name_pool_.insert(mailbox_name_pool_.end(), | 446 mailbox_name_pool_.insert(mailbox_name_pool_.end(), |
440 names.begin(), | 447 names.begin(), |
441 names.end()); | 448 names.end()); |
442 } | 449 } |
443 | 450 |
444 | 451 |
445 } // namespace content | 452 } // namespace content |
OLD | NEW |