| 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 29 matching lines...) Expand all Loading... |
| 40 scoped_refptr<GpuChannelHost> host = new GpuChannelHost(factory, gpu_info); | 40 scoped_refptr<GpuChannelHost> host = new GpuChannelHost(factory, gpu_info); |
| 41 host->Connect(channel_handle, shutdown_event); | 41 host->Connect(channel_handle, shutdown_event); |
| 42 return host; | 42 return host; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // static | 45 // static |
| 46 bool GpuChannelHost::IsValidGpuMemoryBuffer( | 46 bool GpuChannelHost::IsValidGpuMemoryBuffer( |
| 47 gfx::GpuMemoryBufferHandle handle) { | 47 gfx::GpuMemoryBufferHandle handle) { |
| 48 switch (handle.type) { | 48 switch (handle.type) { |
| 49 case gfx::SHARED_MEMORY_BUFFER: | 49 case gfx::SHARED_MEMORY_BUFFER: |
| 50 #if defined(OS_LINUX) |
| 51 case gfx::INTEL_DRM_BUFFER: |
| 52 #endif |
| 50 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) |
| 51 case gfx::IO_SURFACE_BUFFER: | 54 case gfx::IO_SURFACE_BUFFER: |
| 52 #endif | 55 #endif |
| 53 #if defined(OS_ANDROID) | 56 #if defined(OS_ANDROID) |
| 54 case gfx::SURFACE_TEXTURE_BUFFER: | 57 case gfx::SURFACE_TEXTURE_BUFFER: |
| 55 #endif | 58 #endif |
| 56 return true; | 59 return true; |
| 57 default: | 60 default: |
| 58 return false; | 61 return false; |
| 59 } | 62 } |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 #endif | 286 #endif |
| 284 } | 287 } |
| 285 | 288 |
| 286 int32 GpuChannelHost::ReserveTransferBufferId() { | 289 int32 GpuChannelHost::ReserveTransferBufferId() { |
| 287 return next_transfer_buffer_id_.GetNext(); | 290 return next_transfer_buffer_id_.GetNext(); |
| 288 } | 291 } |
| 289 | 292 |
| 290 gfx::GpuMemoryBufferHandle GpuChannelHost::ShareGpuMemoryBufferToGpuProcess( | 293 gfx::GpuMemoryBufferHandle GpuChannelHost::ShareGpuMemoryBufferToGpuProcess( |
| 291 gfx::GpuMemoryBufferHandle source_handle) { | 294 gfx::GpuMemoryBufferHandle source_handle) { |
| 292 switch (source_handle.type) { | 295 switch (source_handle.type) { |
| 296 #if defined(OS_LINUX) |
| 297 case gfx::INTEL_DRM_BUFFER: |
| 298 #endif |
| 293 case gfx::SHARED_MEMORY_BUFFER: { | 299 case gfx::SHARED_MEMORY_BUFFER: { |
| 294 gfx::GpuMemoryBufferHandle handle; | 300 gfx::GpuMemoryBufferHandle handle; |
| 295 handle.type = gfx::SHARED_MEMORY_BUFFER; | 301 handle.type = source_handle.type; |
| 296 handle.handle = ShareToGpuProcess(source_handle.handle); | 302 handle.handle = ShareToGpuProcess(source_handle.handle); |
| 297 return handle; | 303 return handle; |
| 298 } | 304 } |
| 299 #if defined(OS_MACOSX) | 305 #if defined(OS_MACOSX) |
| 300 case gfx::IO_SURFACE_BUFFER: | 306 case gfx::IO_SURFACE_BUFFER: |
| 301 return source_handle; | 307 return source_handle; |
| 302 #endif | 308 #endif |
| 303 #if defined(OS_ANDROID) | 309 #if defined(OS_ANDROID) |
| 304 case gfx::SURFACE_TEXTURE_BUFFER: | 310 case gfx::SURFACE_TEXTURE_BUFFER: |
| 305 return source_handle; | 311 return source_handle; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 396 |
| 391 listeners_.clear(); | 397 listeners_.clear(); |
| 392 } | 398 } |
| 393 | 399 |
| 394 bool GpuChannelHost::MessageFilter::IsLost() const { | 400 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 395 AutoLock lock(lock_); | 401 AutoLock lock(lock_); |
| 396 return lost_; | 402 return lost_; |
| 397 } | 403 } |
| 398 | 404 |
| 399 } // namespace content | 405 } // namespace content |
| OLD | NEW |