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