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 25 matching lines...) Expand all Loading... |
36 #include "base/threading/thread.h" | 36 #include "base/threading/thread.h" |
37 #include "base/threading/thread_restrictions.h" | 37 #include "base/threading/thread_restrictions.h" |
38 #include "base/tracked_objects.h" | 38 #include "base/tracked_objects.h" |
39 #include "cc/base/switches.h" | 39 #include "cc/base/switches.h" |
40 #include "content/browser/appcache/appcache_dispatcher_host.h" | 40 #include "content/browser/appcache/appcache_dispatcher_host.h" |
41 #include "content/browser/appcache/chrome_appcache_service.h" | 41 #include "content/browser/appcache/chrome_appcache_service.h" |
42 #include "content/browser/battery_status/battery_status_message_filter.h" | 42 #include "content/browser/battery_status/battery_status_message_filter.h" |
43 #include "content/browser/browser_child_process_host_impl.h" | 43 #include "content/browser/browser_child_process_host_impl.h" |
44 #include "content/browser/browser_main.h" | 44 #include "content/browser/browser_main.h" |
45 #include "content/browser/browser_main_loop.h" | 45 #include "content/browser/browser_main_loop.h" |
| 46 #include "content/browser/browser_message_filter_peer.h" |
46 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" | 47 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" |
47 #include "content/browser/child_process_security_policy_impl.h" | 48 #include "content/browser/child_process_security_policy_impl.h" |
48 #include "content/browser/device_sensors/device_motion_message_filter.h" | 49 #include "content/browser/device_sensors/device_motion_message_filter.h" |
49 #include "content/browser/device_sensors/device_orientation_message_filter.h" | 50 #include "content/browser/device_sensors/device_orientation_message_filter.h" |
50 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 51 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
51 #include "content/browser/dom_storage/dom_storage_message_filter.h" | 52 #include "content/browser/dom_storage/dom_storage_message_filter.h" |
52 #include "content/browser/download/mhtml_generation_manager.h" | 53 #include "content/browser/download/mhtml_generation_manager.h" |
53 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 54 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
54 #include "content/browser/fileapi/fileapi_message_filter.h" | 55 #include "content/browser/fileapi/fileapi_message_filter.h" |
55 #include "content/browser/frame_host/render_frame_message_filter.h" | 56 #include "content/browser/frame_host/render_frame_message_filter.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 bool is_isolated_guest) | 444 bool is_isolated_guest) |
444 : fast_shutdown_started_(false), | 445 : fast_shutdown_started_(false), |
445 deleting_soon_(false), | 446 deleting_soon_(false), |
446 #ifndef NDEBUG | 447 #ifndef NDEBUG |
447 is_self_deleted_(false), | 448 is_self_deleted_(false), |
448 #endif | 449 #endif |
449 pending_views_(0), | 450 pending_views_(0), |
450 mojo_activation_required_(false), | 451 mojo_activation_required_(false), |
451 visible_widgets_(0), | 452 visible_widgets_(0), |
452 backgrounded_(true), | 453 backgrounded_(true), |
| 454 filter_peer_(new BrowserMessageFilterPeer()), |
453 is_initialized_(false), | 455 is_initialized_(false), |
454 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 456 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
455 browser_context_(browser_context), | 457 browser_context_(browser_context), |
456 storage_partition_impl_(storage_partition_impl), | 458 storage_partition_impl_(storage_partition_impl), |
457 sudden_termination_allowed_(true), | 459 sudden_termination_allowed_(true), |
458 ignore_input_events_(false), | 460 ignore_input_events_(false), |
459 is_isolated_guest_(is_isolated_guest), | 461 is_isolated_guest_(is_isolated_guest), |
460 gpu_observer_registered_(false), | 462 gpu_observer_registered_(false), |
461 delayed_cleanup_needed_(false), | 463 delayed_cleanup_needed_(false), |
462 within_process_died_observer_(false), | 464 within_process_died_observer_(false), |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 } | 1406 } |
1405 return listener->OnMessageReceived(msg); | 1407 return listener->OnMessageReceived(msg); |
1406 } | 1408 } |
1407 | 1409 |
1408 void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { | 1410 void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { |
1409 #if defined(IPC_MESSAGE_LOG_ENABLED) | 1411 #if defined(IPC_MESSAGE_LOG_ENABLED) |
1410 Send(new ChildProcessMsg_SetIPCLoggingEnabled( | 1412 Send(new ChildProcessMsg_SetIPCLoggingEnabled( |
1411 IPC::Logging::GetInstance()->Enabled())); | 1413 IPC::Logging::GetInstance()->Enabled())); |
1412 #endif | 1414 #endif |
1413 | 1415 |
| 1416 filter_peer_->set_pid(peer_pid); |
1414 tracked_objects::ThreadData::Status status = | 1417 tracked_objects::ThreadData::Status status = |
1415 tracked_objects::ThreadData::status(); | 1418 tracked_objects::ThreadData::status(); |
1416 Send(new ChildProcessMsg_SetProfilerStatus(status)); | 1419 Send(new ChildProcessMsg_SetProfilerStatus(status)); |
1417 } | 1420 } |
1418 | 1421 |
1419 void RenderProcessHostImpl::OnChannelError() { | 1422 void RenderProcessHostImpl::OnChannelError() { |
1420 ProcessDied(true /* already_dead */); | 1423 ProcessDied(true /* already_dead */); |
1421 } | 1424 } |
1422 | 1425 |
1423 void RenderProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) { | 1426 void RenderProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 } | 1596 } |
1594 return stop_rtp_dump_callback_; | 1597 return stop_rtp_dump_callback_; |
1595 } | 1598 } |
1596 #endif | 1599 #endif |
1597 | 1600 |
1598 IPC::ChannelProxy* RenderProcessHostImpl::GetChannel() { | 1601 IPC::ChannelProxy* RenderProcessHostImpl::GetChannel() { |
1599 return channel_.get(); | 1602 return channel_.get(); |
1600 } | 1603 } |
1601 | 1604 |
1602 void RenderProcessHostImpl::AddFilter(BrowserMessageFilter* filter) { | 1605 void RenderProcessHostImpl::AddFilter(BrowserMessageFilter* filter) { |
| 1606 // OnFilterRemovedFromHost() is called by BrowserMessageFilter::Internal. |
| 1607 filter->OnFilterAddedToHost(filter_peer_.get()); |
1603 channel_->AddFilter(filter->GetFilter()); | 1608 channel_->AddFilter(filter->GetFilter()); |
1604 } | 1609 } |
1605 | 1610 |
1606 bool RenderProcessHostImpl::FastShutdownForPageCount(size_t count) { | 1611 bool RenderProcessHostImpl::FastShutdownForPageCount(size_t count) { |
1607 if (static_cast<size_t>(GetActiveViewCount()) == count) | 1612 if (static_cast<size_t>(GetActiveViewCount()) == count) |
1608 return FastShutdownIfPossible(); | 1613 return FastShutdownIfPossible(); |
1609 return false; | 1614 return false; |
1610 } | 1615 } |
1611 | 1616 |
1612 bool RenderProcessHostImpl::FastShutdownStarted() const { | 1617 bool RenderProcessHostImpl::FastShutdownStarted() const { |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 void RenderProcessHostImpl::GpuMemoryBufferAllocated( | 2306 void RenderProcessHostImpl::GpuMemoryBufferAllocated( |
2302 IPC::Message* reply, | 2307 IPC::Message* reply, |
2303 const gfx::GpuMemoryBufferHandle& handle) { | 2308 const gfx::GpuMemoryBufferHandle& handle) { |
2304 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2309 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2305 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, | 2310 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, |
2306 handle); | 2311 handle); |
2307 Send(reply); | 2312 Send(reply); |
2308 } | 2313 } |
2309 | 2314 |
2310 } // namespace content | 2315 } // namespace content |
OLD | NEW |