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 #include "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 | 996 |
997 RenderFrameImpl* frame = RenderFrameImpl::FromRoutingID(routing_id); | 997 RenderFrameImpl* frame = RenderFrameImpl::FromRoutingID(routing_id); |
998 if (!frame) | 998 if (!frame) |
999 return; | 999 return; |
1000 | 1000 |
1001 scoped_refptr<PendingRenderFrameConnect> connection(it->second); | 1001 scoped_refptr<PendingRenderFrameConnect> connection(it->second); |
1002 mojo::InterfaceRequest<mojo::ServiceProvider> services( | 1002 mojo::InterfaceRequest<mojo::ServiceProvider> services( |
1003 connection->services().Pass()); | 1003 connection->services().Pass()); |
1004 mojo::ServiceProviderPtr exposed_services( | 1004 mojo::ServiceProviderPtr exposed_services( |
1005 connection->exposed_services().Pass()); | 1005 connection->exposed_services().Pass()); |
1006 exposed_services.set_error_handler(nullptr); | 1006 exposed_services.set_connection_error_handler(mojo::Closure()); |
1007 pending_render_frame_connects_.erase(it); | 1007 pending_render_frame_connects_.erase(it); |
1008 | 1008 |
1009 frame->BindServiceRegistry(services.Pass(), exposed_services.Pass()); | 1009 frame->BindServiceRegistry(services.Pass(), exposed_services.Pass()); |
1010 } | 1010 } |
1011 | 1011 |
1012 void RenderThreadImpl::RemoveRoute(int32 routing_id) { | 1012 void RenderThreadImpl::RemoveRoute(int32 routing_id) { |
1013 ChildThreadImpl::GetRouter()->RemoveRoute(routing_id); | 1013 ChildThreadImpl::GetRouter()->RemoveRoute(routing_id); |
1014 } | 1014 } |
1015 | 1015 |
1016 void RenderThreadImpl::AddEmbeddedWorkerRoute(int32 routing_id, | 1016 void RenderThreadImpl::AddEmbeddedWorkerRoute(int32 routing_id, |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 RenderThreadImpl::PendingRenderFrameConnect::PendingRenderFrameConnect( | 1957 RenderThreadImpl::PendingRenderFrameConnect::PendingRenderFrameConnect( |
1958 int routing_id, | 1958 int routing_id, |
1959 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 1959 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
1960 mojo::ServiceProviderPtr exposed_services) | 1960 mojo::ServiceProviderPtr exposed_services) |
1961 : routing_id_(routing_id), | 1961 : routing_id_(routing_id), |
1962 services_(services.Pass()), | 1962 services_(services.Pass()), |
1963 exposed_services_(exposed_services.Pass()) { | 1963 exposed_services_(exposed_services.Pass()) { |
1964 // The RenderFrame may be deleted before the ExchangeServiceProviders message | 1964 // The RenderFrame may be deleted before the ExchangeServiceProviders message |
1965 // is received. In that case, the RenderFrameHost should close the connection, | 1965 // is received. In that case, the RenderFrameHost should close the connection, |
1966 // which is detected by setting an error handler on |exposed_services_|. | 1966 // which is detected by setting an error handler on |exposed_services_|. |
1967 exposed_services_.set_error_handler(this); | 1967 exposed_services_.set_connection_error_handler(base::Bind( |
| 1968 &RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError, |
| 1969 base::Unretained(this))); |
1968 } | 1970 } |
1969 | 1971 |
1970 RenderThreadImpl::PendingRenderFrameConnect::~PendingRenderFrameConnect() { | 1972 RenderThreadImpl::PendingRenderFrameConnect::~PendingRenderFrameConnect() { |
1971 } | 1973 } |
1972 | 1974 |
1973 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 1975 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
1974 size_t erased = | 1976 size_t erased = |
1975 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 1977 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
1976 routing_id_); | 1978 routing_id_); |
1977 DCHECK_EQ(1u, erased); | 1979 DCHECK_EQ(1u, erased); |
1978 } | 1980 } |
1979 | 1981 |
1980 } // namespace content | 1982 } // namespace content |
OLD | NEW |