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/browser/gpu/browser_gpu_channel_host_factory.h" | 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // In this case we need to wait for this before we can show any UI /anyway/, | 302 // In this case we need to wait for this before we can show any UI /anyway/, |
303 // so it won't cause additional jank. | 303 // so it won't cause additional jank. |
304 // TODO(piman): Make this asynchronous (http://crbug.com/125248). | 304 // TODO(piman): Make this asynchronous (http://crbug.com/125248). |
305 TRACE_EVENT0("browser", | 305 TRACE_EVENT0("browser", |
306 "BrowserGpuChannelHostFactory::CreateViewCommandBuffer"); | 306 "BrowserGpuChannelHostFactory::CreateViewCommandBuffer"); |
307 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 307 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
308 request.event.Wait(); | 308 request.event.Wait(); |
309 return request.result; | 309 return request.result; |
310 } | 310 } |
311 | 311 |
| 312 void BrowserGpuChannelHostFactory::WaitForPendingGpuMemoryBufferUsageToComplete( |
| 313 const base::Closure& callback) { |
| 314 GpuChannelHost* host = GetGpuChannel(); |
| 315 if (!host) { |
| 316 callback.Run(); |
| 317 return; |
| 318 } |
| 319 |
| 320 host->WaitForPendingGpuMemoryBufferUsageToComplete(callback); |
| 321 } |
| 322 |
312 GpuChannelHost* BrowserGpuChannelHostFactory::EstablishGpuChannelSync( | 323 GpuChannelHost* BrowserGpuChannelHostFactory::EstablishGpuChannelSync( |
313 CauseForGpuLaunch cause_for_gpu_launch) { | 324 CauseForGpuLaunch cause_for_gpu_launch) { |
314 EstablishGpuChannel(cause_for_gpu_launch, base::Closure()); | 325 EstablishGpuChannel(cause_for_gpu_launch, base::Closure()); |
315 | 326 |
316 if (pending_request_.get()) | 327 if (pending_request_.get()) |
317 pending_request_->Wait(); | 328 pending_request_->Wait(); |
318 | 329 |
319 return gpu_channel_.get(); | 330 return gpu_channel_.get(); |
320 } | 331 } |
321 | 332 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 filter->AddRoute(MSG_ROUTING_CONTROL, handler); | 412 filter->AddRoute(MSG_ROUTING_CONTROL, handler); |
402 | 413 |
403 GetIOLoopProxy()->PostTask( | 414 GetIOLoopProxy()->PostTask( |
404 FROM_HERE, | 415 FROM_HERE, |
405 base::Bind(&BrowserGpuChannelHostFactory::AddFilterOnIO, | 416 base::Bind(&BrowserGpuChannelHostFactory::AddFilterOnIO, |
406 gpu_host_id_, | 417 gpu_host_id_, |
407 filter)); | 418 filter)); |
408 } | 419 } |
409 | 420 |
410 } // namespace content | 421 } // namespace content |
OLD | NEW |