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> |
11 #include <limits> | 11 #include <limits> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #if defined(OS_POSIX) | 14 #if defined(OS_POSIX) |
15 #include <utility> // for pair<> | 15 #include <utility> // for pair<> |
16 #endif | 16 #endif |
17 | 17 |
18 #include "base/base_switches.h" | 18 #include "base/base_switches.h" |
19 #include "base/bind.h" | 19 #include "base/bind.h" |
20 #include "base/bind_helpers.h" | 20 #include "base/bind_helpers.h" |
21 #include "base/callback.h" | 21 #include "base/callback.h" |
22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
| 23 #include "base/debug/alias.h" |
23 #include "base/debug/trace_event.h" | 24 #include "base/debug/trace_event.h" |
24 #include "base/files/file.h" | 25 #include "base/files/file.h" |
25 #include "base/lazy_instance.h" | 26 #include "base/lazy_instance.h" |
26 #include "base/logging.h" | 27 #include "base/logging.h" |
27 #include "base/metrics/field_trial.h" | 28 #include "base/metrics/field_trial.h" |
28 #include "base/metrics/histogram.h" | 29 #include "base/metrics/histogram.h" |
29 #include "base/path_service.h" | 30 #include "base/path_service.h" |
30 #include "base/process/process_handle.h" | 31 #include "base/process/process_handle.h" |
31 #include "base/rand_util.h" | 32 #include "base/rand_util.h" |
32 #include "base/stl_util.h" | 33 #include "base/stl_util.h" |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 | 912 |
912 void RenderProcessHostImpl::NotifyTimezoneChange() { | 913 void RenderProcessHostImpl::NotifyTimezoneChange() { |
913 Send(new ViewMsg_TimezoneChange()); | 914 Send(new ViewMsg_TimezoneChange()); |
914 } | 915 } |
915 | 916 |
916 ServiceRegistry* RenderProcessHostImpl::GetServiceRegistry() { | 917 ServiceRegistry* RenderProcessHostImpl::GetServiceRegistry() { |
917 DCHECK(mojo_application_host_); | 918 DCHECK(mojo_application_host_); |
918 return mojo_application_host_->service_registry(); | 919 return mojo_application_host_->service_registry(); |
919 } | 920 } |
920 | 921 |
| 922 namespace { |
| 923 struct DebugInfoToCapture { |
| 924 public: |
| 925 DebugInfoToCapture(int32 rid, int pid) |
| 926 : routing_id(rid), process_id(pid) { |
| 927 signature[0] = 'I'; |
| 928 signature[1] = 'N'; |
| 929 signature[2] = 'F'; |
| 930 signature[3] = 'O'; |
| 931 } |
| 932 |
| 933 char signature[4]; |
| 934 int32 routing_id; |
| 935 int process_id; |
| 936 }; |
| 937 } |
| 938 |
921 void RenderProcessHostImpl::AddRoute( | 939 void RenderProcessHostImpl::AddRoute( |
922 int32 routing_id, | 940 int32 routing_id, |
923 IPC::Listener* listener) { | 941 IPC::Listener* listener) { |
924 DCHECK(widget_helper_->IsRoutingIDProbablyValid(routing_id)) | 942 DebugInfoToCapture info(routing_id, GetID()); |
925 << "Found Routing ID conflicts: " << routing_id; | 943 base::debug::Alias(&info); |
| 944 CHECK(widget_helper_->IsRoutingIDProbablyValid(routing_id)) |
| 945 << "Found Invalid Routing ID: " << routing_id; |
| 946 CHECK(!listeners_.Lookup(routing_id)) |
| 947 << "Found Routing ID conflicts: " << routing_id |
| 948 << " with Child PID: " << GetID(); |
926 listeners_.AddWithID(listener, routing_id); | 949 listeners_.AddWithID(listener, routing_id); |
927 } | 950 } |
928 | 951 |
929 void RenderProcessHostImpl::RemoveRoute(int32 routing_id) { | 952 void RenderProcessHostImpl::RemoveRoute(int32 routing_id) { |
930 DCHECK(listeners_.Lookup(routing_id) != NULL); | 953 DCHECK(listeners_.Lookup(routing_id) != NULL); |
931 listeners_.Remove(routing_id); | 954 listeners_.Remove(routing_id); |
932 | 955 |
933 #if defined(OS_WIN) | 956 #if defined(OS_WIN) |
934 // Dump the handle table if handle auditing is enabled. | 957 // Dump the handle table if handle auditing is enabled. |
935 const base::CommandLine& browser_command_line = | 958 const base::CommandLine& browser_command_line = |
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 if (worker_ref_count_ == 0) | 2275 if (worker_ref_count_ == 0) |
2253 Cleanup(); | 2276 Cleanup(); |
2254 } | 2277 } |
2255 | 2278 |
2256 void RenderProcessHostImpl::EnsureMojoActivated() { | 2279 void RenderProcessHostImpl::EnsureMojoActivated() { |
2257 mojo_activation_required_ = true; | 2280 mojo_activation_required_ = true; |
2258 MaybeActivateMojo(); | 2281 MaybeActivateMojo(); |
2259 } | 2282 } |
2260 | 2283 |
2261 } // namespace content | 2284 } // namespace content |
OLD | NEW |