| 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/barrier_closure.h" |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 12 #include "base/message_loop/message_loop_proxy.h" | 13 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "base/posix/eintr_wrapper.h" | 14 #include "base/posix/eintr_wrapper.h" |
| 14 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
| 15 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 16 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| 16 #include "content/common/gpu/gpu_messages.h" | 17 #include "content/common/gpu/gpu_messages.h" |
| 17 #include "ipc/ipc_sync_message_filter.h" | 18 #include "ipc/ipc_sync_message_filter.h" |
| 18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 313 } |
| 313 | 314 |
| 314 int32 GpuChannelHost::ReserveImageId() { | 315 int32 GpuChannelHost::ReserveImageId() { |
| 315 return next_image_id_.GetNext(); | 316 return next_image_id_.GetNext(); |
| 316 } | 317 } |
| 317 | 318 |
| 318 int32 GpuChannelHost::GenerateRouteID() { | 319 int32 GpuChannelHost::GenerateRouteID() { |
| 319 return next_route_id_.GetNext(); | 320 return next_route_id_.GetNext(); |
| 320 } | 321 } |
| 321 | 322 |
| 323 void GpuChannelHost::WaitForPendingGpuMemoryBufferUsageToComplete( |
| 324 const base::Closure& callback) { |
| 325 base::Closure proxy_barrier_closure = |
| 326 base::BarrierClosure(proxies_.size(), callback); |
| 327 |
| 328 AutoLock lock(context_lock_); |
| 329 for (ProxyMap::iterator it = proxies_.begin(); it != proxies_.end(); it++) { |
| 330 it->second->WaitForPendingGpuMemoryBufferUsageToComplete( |
| 331 proxy_barrier_closure); |
| 332 } |
| 333 } |
| 334 |
| 322 GpuChannelHost::~GpuChannelHost() { | 335 GpuChannelHost::~GpuChannelHost() { |
| 323 // channel_ must be destroyed on the main thread. | 336 // channel_ must be destroyed on the main thread. |
| 324 if (!factory_->IsMainThread()) | 337 if (!factory_->IsMainThread()) |
| 325 factory_->GetMainLoop()->DeleteSoon(FROM_HERE, channel_.release()); | 338 factory_->GetMainLoop()->DeleteSoon(FROM_HERE, channel_.release()); |
| 326 } | 339 } |
| 327 | 340 |
| 328 | 341 |
| 329 GpuChannelHost::MessageFilter::MessageFilter() | 342 GpuChannelHost::MessageFilter::MessageFilter() |
| 330 : lost_(false) { | 343 : lost_(false) { |
| 331 } | 344 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 404 |
| 392 listeners_.clear(); | 405 listeners_.clear(); |
| 393 } | 406 } |
| 394 | 407 |
| 395 bool GpuChannelHost::MessageFilter::IsLost() const { | 408 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 396 AutoLock lock(lock_); | 409 AutoLock lock(lock_); |
| 397 return lost_; | 410 return lost_; |
| 398 } | 411 } |
| 399 | 412 |
| 400 } // namespace content | 413 } // namespace content |
| OLD | NEW |