Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 472603002: Mojo: Add the ability to notify a Mojo Channel that it's going to be destroyed soon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 void RenderProcessHostImpl::ResumeResponseDeferredAtStart( 915 void RenderProcessHostImpl::ResumeResponseDeferredAtStart(
916 const GlobalRequestID& request_id) { 916 const GlobalRequestID& request_id) {
917 widget_helper_->ResumeResponseDeferredAtStart(request_id); 917 widget_helper_->ResumeResponseDeferredAtStart(request_id);
918 } 918 }
919 919
920 void RenderProcessHostImpl::NotifyTimezoneChange() { 920 void RenderProcessHostImpl::NotifyTimezoneChange() {
921 Send(new ViewMsg_TimezoneChange()); 921 Send(new ViewMsg_TimezoneChange());
922 } 922 }
923 923
924 ServiceRegistry* RenderProcessHostImpl::GetServiceRegistry() { 924 ServiceRegistry* RenderProcessHostImpl::GetServiceRegistry() {
925 if (!mojo_application_host_) 925 DCHECK(mojo_application_host_);
926 return NULL;
927 return mojo_application_host_->service_registry(); 926 return mojo_application_host_->service_registry();
928 } 927 }
929 928
930 void RenderProcessHostImpl::AddRoute( 929 void RenderProcessHostImpl::AddRoute(
931 int32 routing_id, 930 int32 routing_id,
932 IPC::Listener* listener) { 931 IPC::Listener* listener) {
933 listeners_.AddWithID(listener, routing_id); 932 listeners_.AddWithID(listener, routing_id);
934 } 933 }
935 934
936 void RenderProcessHostImpl::RemoveRoute(int32 routing_id) { 935 void RenderProcessHostImpl::RemoveRoute(int32 routing_id) {
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 within_process_died_observer_ = true; 1913 within_process_died_observer_ = true;
1915 NotificationService::current()->Notify( 1914 NotificationService::current()->Notify(
1916 NOTIFICATION_RENDERER_PROCESS_CLOSED, 1915 NOTIFICATION_RENDERER_PROCESS_CLOSED,
1917 Source<RenderProcessHost>(this), 1916 Source<RenderProcessHost>(this),
1918 Details<RendererClosedDetails>(&details)); 1917 Details<RendererClosedDetails>(&details));
1919 FOR_EACH_OBSERVER(RenderProcessHostObserver, 1918 FOR_EACH_OBSERVER(RenderProcessHostObserver,
1920 observers_, 1919 observers_,
1921 RenderProcessExited(this, GetHandle(), status, exit_code)); 1920 RenderProcessExited(this, GetHandle(), status, exit_code));
1922 within_process_died_observer_ = false; 1921 within_process_died_observer_ = false;
1923 1922
1923 mojo_application_host_->WillDestroySoon();
1924
1924 child_process_launcher_.reset(); 1925 child_process_launcher_.reset();
1925 channel_.reset(); 1926 channel_.reset();
1926 gpu_message_filter_ = NULL; 1927 gpu_message_filter_ = NULL;
1927 message_port_message_filter_ = NULL; 1928 message_port_message_filter_ = NULL;
1928 RemoveUserData(kSessionStorageHolderKey); 1929 RemoveUserData(kSessionStorageHolderKey);
1929 1930
1930 IDMap<IPC::Listener>::iterator iter(&listeners_); 1931 IDMap<IPC::Listener>::iterator iter(&listeners_);
1931 while (!iter.IsAtEnd()) { 1932 while (!iter.IsAtEnd()) {
1932 iter.GetCurrentValue()->OnMessageReceived( 1933 iter.GetCurrentValue()->OnMessageReceived(
1933 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), 1934 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(),
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2016 if (pending_views_ || num_active_views > 0 || run_renderer_in_process()) 2017 if (pending_views_ || num_active_views > 0 || run_renderer_in_process())
2017 return; 2018 return;
2018 2019
2019 // Notify any contents that might have swapped out renderers from this 2020 // Notify any contents that might have swapped out renderers from this
2020 // process. They should not attempt to swap them back in. 2021 // process. They should not attempt to swap them back in.
2021 NotificationService::current()->Notify( 2022 NotificationService::current()->Notify(
2022 NOTIFICATION_RENDERER_PROCESS_CLOSING, 2023 NOTIFICATION_RENDERER_PROCESS_CLOSING,
2023 Source<RenderProcessHost>(this), 2024 Source<RenderProcessHost>(this),
2024 NotificationService::NoDetails()); 2025 NotificationService::NoDetails());
2025 2026
2027 mojo_application_host_->WillDestroySoon();
2028
2026 Send(new ChildProcessMsg_Shutdown()); 2029 Send(new ChildProcessMsg_Shutdown());
2027 } 2030 }
2028 2031
2029 void RenderProcessHostImpl::SuddenTerminationChanged(bool enabled) { 2032 void RenderProcessHostImpl::SuddenTerminationChanged(bool enabled) {
2030 SetSuddenTerminationAllowed(enabled); 2033 SetSuddenTerminationAllowed(enabled);
2031 } 2034 }
2032 2035
2033 void RenderProcessHostImpl::OnDumpHandlesDone() { 2036 void RenderProcessHostImpl::OnDumpHandlesDone() {
2034 Cleanup(); 2037 Cleanup();
2035 } 2038 }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2350 } 2353 }
2351 2354
2352 void RenderProcessHostImpl::OnDeletedGpuMemoryBuffer( 2355 void RenderProcessHostImpl::OnDeletedGpuMemoryBuffer(
2353 gfx::GpuMemoryBufferType type, 2356 gfx::GpuMemoryBufferType type,
2354 const gfx::GpuMemoryBufferId& id) { 2357 const gfx::GpuMemoryBufferId& id) {
2355 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2358 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2356 GpuMemoryBufferImpl::DeletedByChildProcess(type, id, GetHandle()); 2359 GpuMemoryBufferImpl::DeletedByChildProcess(type, id, GetHandle());
2357 } 2360 }
2358 2361
2359 } // namespace content 2362 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698