| 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 #if defined(OS_WIN) | 5 #if defined(OS_WIN) |
| 6 #include <windows.h> | 6 #include <windows.h> |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "content/browser/renderer_host/gpu_message_filter.h" | 9 #include "content/browser/renderer_host/gpu_message_filter.h" |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 GpuMessageFilter::~GpuMessageFilter() { | 28 GpuMessageFilter::~GpuMessageFilter() { |
| 29 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 29 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 30 } | 30 } |
| 31 | 31 |
| 32 bool GpuMessageFilter::OnMessageReceived(const IPC::Message& message) { | 32 bool GpuMessageFilter::OnMessageReceived(const IPC::Message& message) { |
| 33 bool handled = true; | 33 bool handled = true; |
| 34 IPC_BEGIN_MESSAGE_MAP(GpuMessageFilter, message) | 34 IPC_BEGIN_MESSAGE_MAP(GpuMessageFilter, message) |
| 35 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_EstablishGpuChannel, | 35 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_EstablishGpuChannel, |
| 36 OnEstablishGpuChannel) | 36 OnEstablishGpuChannel) |
| 37 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_HasGpuProcess, OnHasGpuProcess) |
| 37 IPC_MESSAGE_UNHANDLED(handled = false) | 38 IPC_MESSAGE_UNHANDLED(handled = false) |
| 38 IPC_END_MESSAGE_MAP() | 39 IPC_END_MESSAGE_MAP() |
| 39 return handled; | 40 return handled; |
| 40 } | 41 } |
| 41 | 42 |
| 42 void GpuMessageFilter::OnEstablishGpuChannel( | 43 void GpuMessageFilter::OnEstablishGpuChannel( |
| 43 CauseForGpuLaunch cause_for_gpu_launch, | 44 CauseForGpuLaunch cause_for_gpu_launch, |
| 44 IPC::Message* reply_ptr) { | 45 IPC::Message* reply_ptr) { |
| 45 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 46 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 46 scoped_ptr<IPC::Message> reply(reply_ptr); | 47 scoped_ptr<IPC::Message> reply(reply_ptr); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 73 bool allow_real_time_streams = false; | 74 bool allow_real_time_streams = false; |
| 74 host->EstablishGpuChannel( | 75 host->EstablishGpuChannel( |
| 75 render_process_id_, | 76 render_process_id_, |
| 76 ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( | 77 ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( |
| 77 render_process_id_), | 78 render_process_id_), |
| 78 preempts, allow_view_command_buffers, allow_real_time_streams, | 79 preempts, allow_view_command_buffers, allow_real_time_streams, |
| 79 base::Bind(&GpuMessageFilter::EstablishChannelCallback, | 80 base::Bind(&GpuMessageFilter::EstablishChannelCallback, |
| 80 weak_ptr_factory_.GetWeakPtr(), base::Passed(&reply))); | 81 weak_ptr_factory_.GetWeakPtr(), base::Passed(&reply))); |
| 81 } | 82 } |
| 82 | 83 |
| 84 void GpuMessageFilter::OnHasGpuProcess(IPC::Message* reply_ptr) { |
| 85 scoped_ptr<IPC::Message> reply(reply_ptr); |
| 86 GpuProcessHost::GetProcessHandles( |
| 87 base::Bind(&GpuMessageFilter::GetGpuProcessHandlesCallback, |
| 88 weak_ptr_factory_.GetWeakPtr(), base::Passed(&reply))); |
| 89 } |
| 90 |
| 83 void GpuMessageFilter::EstablishChannelCallback( | 91 void GpuMessageFilter::EstablishChannelCallback( |
| 84 scoped_ptr<IPC::Message> reply, | 92 scoped_ptr<IPC::Message> reply, |
| 85 const IPC::ChannelHandle& channel, | 93 const IPC::ChannelHandle& channel, |
| 86 const gpu::GPUInfo& gpu_info) { | 94 const gpu::GPUInfo& gpu_info) { |
| 87 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 95 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 88 | 96 |
| 89 GpuHostMsg_EstablishGpuChannel::WriteReplyParams( | 97 GpuHostMsg_EstablishGpuChannel::WriteReplyParams( |
| 90 reply.get(), render_process_id_, channel, gpu_info); | 98 reply.get(), render_process_id_, channel, gpu_info); |
| 91 Send(reply.release()); | 99 Send(reply.release()); |
| 92 } | 100 } |
| 93 | 101 |
| 102 void GpuMessageFilter::GetGpuProcessHandlesCallback( |
| 103 scoped_ptr<IPC::Message> reply, |
| 104 const std::list<base::ProcessHandle>& handles) { |
| 105 bool has_gpu_process = handles.size() > 0; |
| 106 GpuHostMsg_HasGpuProcess::WriteReplyParams(reply.get(), has_gpu_process); |
| 107 Send(reply.release()); |
| 108 } |
| 109 |
| 94 } // namespace content | 110 } // namespace content |
| OLD | NEW |