| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 #endif | 273 #endif |
| 271 } | 274 } |
| 272 | 275 |
| 273 int32 GpuChannelHost::ReserveTransferBufferId() { | 276 int32 GpuChannelHost::ReserveTransferBufferId() { |
| 274 return next_transfer_buffer_id_.GetNext(); | 277 return next_transfer_buffer_id_.GetNext(); |
| 275 } | 278 } |
| 276 | 279 |
| 277 gfx::GpuMemoryBufferHandle GpuChannelHost::ShareGpuMemoryBufferToGpuProcess( | 280 gfx::GpuMemoryBufferHandle GpuChannelHost::ShareGpuMemoryBufferToGpuProcess( |
| 278 gfx::GpuMemoryBufferHandle source_handle) { | 281 gfx::GpuMemoryBufferHandle source_handle) { |
| 279 switch (source_handle.type) { | 282 switch (source_handle.type) { |
| 283 #if defined(OS_LINUX) |
| 284 case gfx::INTEL_DRM_BUFFER: |
| 285 #endif |
| 280 case gfx::SHARED_MEMORY_BUFFER: { | 286 case gfx::SHARED_MEMORY_BUFFER: { |
| 281 gfx::GpuMemoryBufferHandle handle; | 287 gfx::GpuMemoryBufferHandle handle; |
| 282 handle.type = gfx::SHARED_MEMORY_BUFFER; | 288 handle.type = source_handle.type; |
| 283 handle.handle = ShareToGpuProcess(source_handle.handle); | 289 handle.handle = ShareToGpuProcess(source_handle.handle); |
| 284 return handle; | 290 return handle; |
| 285 } | 291 } |
| 286 #if defined(OS_MACOSX) | 292 #if defined(OS_MACOSX) |
| 287 case gfx::IO_SURFACE_BUFFER: | 293 case gfx::IO_SURFACE_BUFFER: |
| 288 return source_handle; | 294 return source_handle; |
| 289 #endif | 295 #endif |
| 290 #if defined(OS_ANDROID) | 296 #if defined(OS_ANDROID) |
| 291 case gfx::SURFACE_TEXTURE_BUFFER: | 297 case gfx::SURFACE_TEXTURE_BUFFER: |
| 292 return source_handle; | 298 return source_handle; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 383 |
| 378 listeners_.clear(); | 384 listeners_.clear(); |
| 379 } | 385 } |
| 380 | 386 |
| 381 bool GpuChannelHost::MessageFilter::IsLost() const { | 387 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 382 AutoLock lock(lock_); | 388 AutoLock lock(lock_); |
| 383 return lost_; | 389 return lost_; |
| 384 } | 390 } |
| 385 | 391 |
| 386 } // namespace content | 392 } // namespace content |
| OLD | NEW |