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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
867 pending_render_frame_connects_.find(routing_id); | 867 pending_render_frame_connects_.find(routing_id); |
868 if (it == pending_render_frame_connects_.end()) | 868 if (it == pending_render_frame_connects_.end()) |
869 return; | 869 return; |
870 | 870 |
871 RenderFrameImpl* frame = RenderFrameImpl::FromRoutingID(routing_id); | 871 RenderFrameImpl* frame = RenderFrameImpl::FromRoutingID(routing_id); |
872 if (!frame) | 872 if (!frame) |
873 return; | 873 return; |
874 | 874 |
875 scoped_refptr<PendingRenderFrameConnect> connection(it->second); | 875 scoped_refptr<PendingRenderFrameConnect> connection(it->second); |
876 mojo::InterfaceRequest<mojo::ServiceProvider> services( | 876 mojo::InterfaceRequest<mojo::ServiceProvider> services( |
877 connection->services.Pass()); | 877 connection->services().Pass()); |
878 mojo::ServiceProviderPtr exposed_services( | 878 mojo::ServiceProviderPtr exposed_services( |
879 connection->exposed_services.Pass()); | 879 connection->exposed_services().Pass()); |
880 exposed_services.set_error_handler(nullptr); | |
880 pending_render_frame_connects_.erase(it); | 881 pending_render_frame_connects_.erase(it); |
881 | 882 |
882 frame->BindServiceRegistry(services.Pass(), exposed_services.Pass()); | 883 frame->BindServiceRegistry(services.Pass(), exposed_services.Pass()); |
883 } | 884 } |
884 | 885 |
885 void RenderThreadImpl::RemoveRoute(int32 routing_id) { | 886 void RenderThreadImpl::RemoveRoute(int32 routing_id) { |
886 ChildThreadImpl::GetRouter()->RemoveRoute(routing_id); | 887 ChildThreadImpl::GetRouter()->RemoveRoute(routing_id); |
887 } | 888 } |
888 | 889 |
889 void RenderThreadImpl::AddEmbeddedWorkerRoute(int32 routing_id, | 890 void RenderThreadImpl::AddEmbeddedWorkerRoute(int32 routing_id, |
(...skipping 14 matching lines...) Expand all Loading... | |
904 } | 905 } |
905 | 906 |
906 void RenderThreadImpl::RegisterPendingRenderFrameConnect( | 907 void RenderThreadImpl::RegisterPendingRenderFrameConnect( |
907 int routing_id, | 908 int routing_id, |
908 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 909 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
909 mojo::ServiceProviderPtr exposed_services) { | 910 mojo::ServiceProviderPtr exposed_services) { |
910 std::pair<PendingRenderFrameConnectMap::iterator, bool> result = | 911 std::pair<PendingRenderFrameConnectMap::iterator, bool> result = |
911 pending_render_frame_connects_.insert(std::make_pair( | 912 pending_render_frame_connects_.insert(std::make_pair( |
912 routing_id, | 913 routing_id, |
913 make_scoped_refptr(new PendingRenderFrameConnect( | 914 make_scoped_refptr(new PendingRenderFrameConnect( |
914 services.Pass(), | 915 routing_id, services.Pass(), exposed_services.Pass())))); |
915 exposed_services.Pass())))); | |
916 CHECK(result.second) << "Inserting a duplicate item."; | 916 CHECK(result.second) << "Inserting a duplicate item."; |
917 } | 917 } |
918 | 918 |
919 int RenderThreadImpl::GenerateRoutingID() { | 919 int RenderThreadImpl::GenerateRoutingID() { |
920 int routing_id = MSG_ROUTING_NONE; | 920 int routing_id = MSG_ROUTING_NONE; |
921 Send(new ViewHostMsg_GenerateRoutingID(&routing_id)); | 921 Send(new ViewHostMsg_GenerateRoutingID(&routing_id)); |
922 return routing_id; | 922 return routing_id; |
923 } | 923 } |
924 | 924 |
925 void RenderThreadImpl::AddFilter(IPC::MessageFilter* filter) { | 925 void RenderThreadImpl::AddFilter(IPC::MessageFilter* filter) { |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1783 hidden_widget_count_--; | 1783 hidden_widget_count_--; |
1784 | 1784 |
1785 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1785 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1786 return; | 1786 return; |
1787 } | 1787 } |
1788 | 1788 |
1789 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1789 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1790 } | 1790 } |
1791 | 1791 |
1792 RenderThreadImpl::PendingRenderFrameConnect::PendingRenderFrameConnect( | 1792 RenderThreadImpl::PendingRenderFrameConnect::PendingRenderFrameConnect( |
1793 int routing_id, | |
1793 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 1794 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
1794 mojo::ServiceProviderPtr exposed_services) | 1795 mojo::ServiceProviderPtr exposed_services) |
1795 : services(services.Pass()), | 1796 : routing_id_(routing_id), |
1796 exposed_services(exposed_services.Pass()) { | 1797 services_(services.Pass()), |
1798 exposed_services_(exposed_services.Pass()) { | |
1799 // The RenderFrame may be deleted before the ExchangeServiceProviders message | |
1800 // is received. In that case, the RenderFrameHost should close the connection, | |
1801 // which is detected by setting an error handler on |exposed_services_|. | |
1802 exposed_services_.set_error_handler(this); | |
1797 } | 1803 } |
1798 | 1804 |
1799 RenderThreadImpl::PendingRenderFrameConnect::~PendingRenderFrameConnect() { | 1805 RenderThreadImpl::PendingRenderFrameConnect::~PendingRenderFrameConnect() { |
1800 } | 1806 } |
1801 | 1807 |
1808 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | |
1809 size_t erased = | |
1810 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | |
1811 routing_id_); | |
1812 DCHECK_EQ(erased, 1u); | |
Avi (use Gerrit)
2015/03/13 13:54:07
Put the expected value first; if the DCHECK fails,
Sam McNally
2015/03/15 22:28:19
Done.
| |
1813 } | |
1814 | |
1802 } // namespace content | 1815 } // namespace content |
OLD | NEW |