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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 IPC::Listener* listener = listeners_.Lookup(msg.routing_id()); | 1399 IPC::Listener* listener = listeners_.Lookup(msg.routing_id()); |
1400 if (!listener) { | 1400 if (!listener) { |
1401 if (msg.is_sync()) { | 1401 if (msg.is_sync()) { |
1402 // The listener has gone away, so we must respond or else the caller will | 1402 // The listener has gone away, so we must respond or else the caller will |
1403 // hang waiting for a reply. | 1403 // hang waiting for a reply. |
1404 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); | 1404 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); |
1405 reply->set_reply_error(); | 1405 reply->set_reply_error(); |
1406 Send(reply); | 1406 Send(reply); |
1407 } | 1407 } |
1408 | 1408 |
1409 #if defined(OS_MACOSX) | |
1410 // If this is a SwapBuffers, we need to ack it if we're not going to handle | 1409 // If this is a SwapBuffers, we need to ack it if we're not going to handle |
1411 // it so that the GPU process doesn't get stuck in unscheduled state. | 1410 // it so that the GPU process doesn't get stuck in unscheduled state. |
1412 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) | 1411 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) |
1413 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, | 1412 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, |
1414 OnCompositorSurfaceBuffersSwappedNoHost) | 1413 OnCompositorSurfaceBuffersSwappedNoHost) |
1415 IPC_END_MESSAGE_MAP() | 1414 IPC_END_MESSAGE_MAP() |
1416 #endif | |
1417 return true; | 1415 return true; |
1418 } | 1416 } |
1419 return listener->OnMessageReceived(msg); | 1417 return listener->OnMessageReceived(msg); |
1420 } | 1418 } |
1421 | 1419 |
1422 void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { | 1420 void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { |
1423 #if defined(IPC_MESSAGE_LOG_ENABLED) | 1421 #if defined(IPC_MESSAGE_LOG_ENABLED) |
1424 Send(new ChildProcessMsg_SetIPCLoggingEnabled( | 1422 Send(new ChildProcessMsg_SetIPCLoggingEnabled( |
1425 IPC::Logging::GetInstance()->Enabled())); | 1423 IPC::Logging::GetInstance()->Enabled())); |
1426 #endif | 1424 #endif |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2137 (GetUserData(kSessionStorageHolderKey)); | 2135 (GetUserData(kSessionStorageHolderKey)); |
2138 if (!holder) | 2136 if (!holder) |
2139 return; | 2137 return; |
2140 holder->Release(old_route_id); | 2138 holder->Release(old_route_id); |
2141 } | 2139 } |
2142 | 2140 |
2143 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 2141 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
2144 MHTMLGenerationManager::GetInstance()->MHTMLGenerated(job_id, data_size); | 2142 MHTMLGenerationManager::GetInstance()->MHTMLGenerated(job_id, data_size); |
2145 } | 2143 } |
2146 | 2144 |
2147 #if defined(OS_MACOSX) | |
2148 void RenderProcessHostImpl::OnCompositorSurfaceBuffersSwappedNoHost( | 2145 void RenderProcessHostImpl::OnCompositorSurfaceBuffersSwappedNoHost( |
2149 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) { | 2146 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) { |
2150 TRACE_EVENT0("renderer_host", | 2147 TRACE_EVENT0("renderer_host", |
2151 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 2148 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
2152 if (!ui::LatencyInfo::Verify(params.latency_info, | 2149 if (!ui::LatencyInfo::Verify(params.latency_info, |
2153 "ViewHostMsg_CompositorSurfaceBuffersSwapped")) | 2150 "ViewHostMsg_CompositorSurfaceBuffersSwapped")) |
2154 return; | 2151 return; |
2155 | |
2156 if (params.use_native_widget) { | |
2157 RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnUIThread(params); | |
2158 return; | |
2159 } | |
2160 | |
2161 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 2152 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
2162 ack_params.sync_point = 0; | 2153 ack_params.sync_point = 0; |
2163 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, | 2154 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, |
2164 params.gpu_process_host_id, | 2155 params.gpu_process_host_id, |
2165 ack_params); | 2156 ack_params); |
2166 } | 2157 } |
2167 #endif | |
2168 | 2158 |
2169 void RenderProcessHostImpl::OnGpuSwitching() { | 2159 void RenderProcessHostImpl::OnGpuSwitching() { |
2170 // We are updating all widgets including swapped out ones. | 2160 // We are updating all widgets including swapped out ones. |
2171 scoped_ptr<RenderWidgetHostIterator> widgets( | 2161 scoped_ptr<RenderWidgetHostIterator> widgets( |
2172 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); | 2162 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); |
2173 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 2163 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
2174 if (!widget->IsRenderView()) | 2164 if (!widget->IsRenderView()) |
2175 continue; | 2165 continue; |
2176 | 2166 |
2177 // Skip widgets in other processes. | 2167 // Skip widgets in other processes. |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 void RenderProcessHostImpl::GpuMemoryBufferAllocated( | 2362 void RenderProcessHostImpl::GpuMemoryBufferAllocated( |
2373 IPC::Message* reply, | 2363 IPC::Message* reply, |
2374 const gfx::GpuMemoryBufferHandle& handle) { | 2364 const gfx::GpuMemoryBufferHandle& handle) { |
2375 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2365 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2376 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, | 2366 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, |
2377 handle); | 2367 handle); |
2378 Send(reply); | 2368 Send(reply); |
2379 } | 2369 } |
2380 | 2370 |
2381 } // namespace content | 2371 } // namespace content |
OLD | NEW |