Chromium Code Reviews| 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 "gpu/ipc/client/gpu_channel_host.h" | 5 #include "gpu/ipc/client/gpu_channel_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/posix/eintr_wrapper.h" | 14 #include "base/posix/eintr_wrapper.h" |
| 15 #include "base/profiler/scoped_tracker.h" | 15 #include "base/profiler/scoped_tracker.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
| 18 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 19 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 21 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 22 #include "gpu/ipc/common/gpu_messages.h" | 22 #include "gpu/ipc/common/gpu_messages.h" |
| 23 #include "gpu/ipc/common/gpu_param_traits_macros.h" | 23 #include "gpu/ipc/common/gpu_param_traits_macros.h" |
| 24 #include "ipc/ipc_sync_message_filter.h" | 24 #include "ipc/ipc_sync_message_filter.h" |
| 25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 26 | 26 |
| 27 #if defined(OS_MACOSX) | |
| 28 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" | |
| 29 #endif | |
| 30 | |
| 27 using base::AutoLock; | 31 using base::AutoLock; |
| 28 | 32 |
| 29 namespace gpu { | 33 namespace gpu { |
| 30 namespace { | 34 namespace { |
| 31 | 35 |
| 32 // Global atomic to generate unique transfer buffer IDs. | 36 // Global atomic to generate unique transfer buffer IDs. |
| 33 base::StaticAtomicSequenceNumber g_next_transfer_buffer_id; | 37 base::StaticAtomicSequenceNumber g_next_transfer_buffer_id; |
| 34 | 38 |
| 35 } // namespace | 39 } // namespace |
| 36 | 40 |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 const IPC::Message& message) { | 443 const IPC::Message& message) { |
| 440 // Never handle sync message replies or we will deadlock here. | 444 // Never handle sync message replies or we will deadlock here. |
| 441 if (message.is_reply()) | 445 if (message.is_reply()) |
| 442 return false; | 446 return false; |
| 443 | 447 |
| 444 auto it = listeners_.find(message.routing_id()); | 448 auto it = listeners_.find(message.routing_id()); |
| 445 if (it == listeners_.end()) | 449 if (it == listeners_.end()) |
| 446 return false; | 450 return false; |
| 447 | 451 |
| 448 const ListenerInfo& info = it->second; | 452 const ListenerInfo& info = it->second; |
| 449 info.task_runner->PostTask( | 453 scoped_refptr<base::SingleThreadTaskRunner> task_runner = info.task_runner; |
| 454 #if defined(OS_MACOSX) | |
| 455 // On Mac, the IPCs ViewHostMsg_SwapCompositorFrame, ViewHostMsg_UpdateRect, | |
| 456 // and GpuCommandBufferMsg_SwapBuffersCompleted need to be handled in a | |
| 457 // nested message loop during resize. | |
| 458 if (message.type() == GpuCommandBufferMsg_SwapBuffersCompleted::ID) | |
| 459 task_runner = ui::WindowResizeHelperMac::Get()->task_runner(); | |
|
piman
2016/05/10 22:24:16
This is called in the renderer - e.g. for pepper.
ccameron
2016/05/11 06:23:01
Good point -- moved the #if MAC parts into GpuProc
| |
| 460 #endif | |
| 461 task_runner->PostTask( | |
| 450 FROM_HERE, | 462 FROM_HERE, |
| 451 base::Bind(base::IgnoreResult(&IPC::Listener::OnMessageReceived), | 463 base::Bind(base::IgnoreResult(&IPC::Listener::OnMessageReceived), |
| 452 info.listener, message)); | 464 info.listener, message)); |
| 453 return true; | 465 return true; |
| 454 } | 466 } |
| 455 | 467 |
| 456 void GpuChannelHost::MessageFilter::OnChannelError() { | 468 void GpuChannelHost::MessageFilter::OnChannelError() { |
| 457 // Set the lost state before signalling the proxies. That way, if they | 469 // Set the lost state before signalling the proxies. That way, if they |
| 458 // themselves post a task to recreate the context, they will not try to re-use | 470 // themselves post a task to recreate the context, they will not try to re-use |
| 459 // this channel host. | 471 // this channel host. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 472 | 484 |
| 473 listeners_.clear(); | 485 listeners_.clear(); |
| 474 } | 486 } |
| 475 | 487 |
| 476 bool GpuChannelHost::MessageFilter::IsLost() const { | 488 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 477 AutoLock lock(lock_); | 489 AutoLock lock(lock_); |
| 478 return lost_; | 490 return lost_; |
| 479 } | 491 } |
| 480 | 492 |
| 481 } // namespace gpu | 493 } // namespace gpu |
| OLD | NEW |