OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
524 gpu_observer_registered_(false), | 524 gpu_observer_registered_(false), |
525 delayed_cleanup_needed_(false), | 525 delayed_cleanup_needed_(false), |
526 within_process_died_observer_(false), | 526 within_process_died_observer_(false), |
527 power_monitor_broadcaster_(this), | 527 power_monitor_broadcaster_(this), |
528 worker_ref_count_(0), | 528 worker_ref_count_(0), |
529 max_worker_count_(0), | 529 max_worker_count_(0), |
530 permission_service_context_(new PermissionServiceContext(this)), | 530 permission_service_context_(new PermissionServiceContext(this)), |
531 pending_valuebuffer_state_(new gpu::ValueStateMap()), | 531 pending_valuebuffer_state_(new gpu::ValueStateMap()), |
532 subscribe_uniform_enabled_(false), | 532 subscribe_uniform_enabled_(false), |
533 channel_connected_(false), | 533 channel_connected_(false), |
534 mojo_ready_(false), | |
Fady Samuel
2015/11/24 04:42:38
Revert this.
| |
534 sent_render_process_ready_(false), | 535 sent_render_process_ready_(false), |
535 #if defined(OS_ANDROID) | 536 #if defined(OS_ANDROID) |
536 never_signaled_(true, false), | 537 never_signaled_(true, false), |
537 #endif | 538 #endif |
538 weak_factory_(this) { | 539 weak_factory_(this) { |
539 widget_helper_ = new RenderWidgetHelper(); | 540 widget_helper_ = new RenderWidgetHelper(); |
540 | 541 |
541 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 542 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
542 | 543 |
543 CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); | 544 CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1527 | 1528 |
1528 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) | 1529 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) |
1529 return base::kNullProcessHandle; | 1530 return base::kNullProcessHandle; |
1530 | 1531 |
1531 return child_process_launcher_->GetProcess().Handle(); | 1532 return child_process_launcher_->GetProcess().Handle(); |
1532 } | 1533 } |
1533 | 1534 |
1534 bool RenderProcessHostImpl::IsReady() const { | 1535 bool RenderProcessHostImpl::IsReady() const { |
1535 // The process launch result (that sets GetHandle()) and the channel | 1536 // The process launch result (that sets GetHandle()) and the channel |
1536 // connection (that sets channel_connected_) can happen in either order. | 1537 // connection (that sets channel_connected_) can happen in either order. |
1537 return GetHandle() && channel_connected_; | 1538 return GetHandle() && channel_connected_ && mojo_ready_; |
1538 } | 1539 } |
1539 | 1540 |
1540 bool RenderProcessHostImpl::Shutdown(int exit_code, bool wait) { | 1541 bool RenderProcessHostImpl::Shutdown(int exit_code, bool wait) { |
1541 if (run_renderer_in_process()) | 1542 if (run_renderer_in_process()) |
1542 return false; // Single process mode never shuts down the renderer. | 1543 return false; // Single process mode never shuts down the renderer. |
1543 | 1544 |
1544 #if defined(OS_ANDROID) | 1545 #if defined(OS_ANDROID) |
1545 // Android requires a different approach for killing. | 1546 // Android requires a different approach for killing. |
1546 StopChildProcess(GetHandle()); | 1547 StopChildProcess(GetHandle()); |
1547 return true; | 1548 return true; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1619 // Dispatch control messages. | 1620 // Dispatch control messages. |
1620 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) | 1621 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) |
1621 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, | 1622 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, |
1622 OnShutdownRequest) | 1623 OnShutdownRequest) |
1623 IPC_MESSAGE_HANDLER(RenderProcessHostMsg_SuddenTerminationChanged, | 1624 IPC_MESSAGE_HANDLER(RenderProcessHostMsg_SuddenTerminationChanged, |
1624 SuddenTerminationChanged) | 1625 SuddenTerminationChanged) |
1625 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, | 1626 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, |
1626 OnUserMetricsRecordAction) | 1627 OnUserMetricsRecordAction) |
1627 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) | 1628 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) |
1628 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK) | 1629 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK) |
1630 IPC_MESSAGE_HANDLER(MojoHostMsg_MojoReady, OnMojoReady) | |
1629 #if defined(ENABLE_WEBRTC) | 1631 #if defined(ENABLE_WEBRTC) |
1630 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer, | 1632 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer, |
1631 OnRegisterAecDumpConsumer) | 1633 OnRegisterAecDumpConsumer) |
1632 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer, | 1634 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer, |
1633 OnUnregisterAecDumpConsumer) | 1635 OnUnregisterAecDumpConsumer) |
1634 #endif | 1636 #endif |
1635 // Adding single handlers for your service here is fine, but once your | 1637 // Adding single handlers for your service here is fine, but once your |
1636 // service needs more than one handler, please extract them into a new | 1638 // service needs more than one handler, please extract them into a new |
1637 // message filter and add that filter to CreateMessageFilters(). | 1639 // message filter and add that filter to CreateMessageFilters(). |
1638 IPC_END_MESSAGE_MAP() | 1640 IPC_END_MESSAGE_MAP() |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2494 } | 2496 } |
2495 | 2497 |
2496 void RenderProcessHostImpl::OnCloseACK(int old_route_id) { | 2498 void RenderProcessHostImpl::OnCloseACK(int old_route_id) { |
2497 SessionStorageHolder* holder = | 2499 SessionStorageHolder* holder = |
2498 static_cast<SessionStorageHolder*>(GetUserData(kSessionStorageHolderKey)); | 2500 static_cast<SessionStorageHolder*>(GetUserData(kSessionStorageHolderKey)); |
2499 if (!holder) | 2501 if (!holder) |
2500 return; | 2502 return; |
2501 holder->Release(old_route_id); | 2503 holder->Release(old_route_id); |
2502 } | 2504 } |
2503 | 2505 |
2506 void RenderProcessHostImpl::OnMojoReady() { | |
2507 mojo_ready_ = true; | |
2508 if (IsReady()) { | |
2509 DCHECK(!sent_render_process_ready_); | |
2510 sent_render_process_ready_ = true; | |
2511 // Send RenderProcessReady only if we already received the process handle. | |
2512 FOR_EACH_OBSERVER(RenderProcessHostObserver, observers_, | |
2513 RenderProcessReady(this)); | |
2514 } | |
2515 } | |
2516 | |
2504 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 2517 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
2505 bool mhtml_generation_in_renderer_succeeded = data_size >= 0; | 2518 bool mhtml_generation_in_renderer_succeeded = data_size >= 0; |
2506 MHTMLGenerationManager::GetInstance()->OnSavedPageAsMHTML( | 2519 MHTMLGenerationManager::GetInstance()->OnSavedPageAsMHTML( |
2507 job_id, mhtml_generation_in_renderer_succeeded); | 2520 job_id, mhtml_generation_in_renderer_succeeded); |
2508 } | 2521 } |
2509 | 2522 |
2510 void RenderProcessHostImpl::OnGpuSwitched() { | 2523 void RenderProcessHostImpl::OnGpuSwitched() { |
2511 // We are updating all widgets including swapped out ones. | 2524 // We are updating all widgets including swapped out ones. |
2512 scoped_ptr<RenderWidgetHostIterator> widgets( | 2525 scoped_ptr<RenderWidgetHostIterator> widgets( |
2513 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); | 2526 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2609 void RenderProcessHostImpl::GetAudioOutputControllers( | 2622 void RenderProcessHostImpl::GetAudioOutputControllers( |
2610 const GetAudioOutputControllersCallback& callback) const { | 2623 const GetAudioOutputControllersCallback& callback) const { |
2611 audio_renderer_host()->GetOutputControllers(callback); | 2624 audio_renderer_host()->GetOutputControllers(callback); |
2612 } | 2625 } |
2613 | 2626 |
2614 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2627 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { |
2615 return bluetooth_dispatcher_host_.get(); | 2628 return bluetooth_dispatcher_host_.get(); |
2616 } | 2629 } |
2617 | 2630 |
2618 } // namespace content | 2631 } // namespace content |
OLD | NEW |