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" | |
24 #include "base/debug/trace_event.h" | 23 #include "base/debug/trace_event.h" |
25 #include "base/files/file.h" | 24 #include "base/files/file.h" |
26 #include "base/lazy_instance.h" | 25 #include "base/lazy_instance.h" |
27 #include "base/logging.h" | 26 #include "base/logging.h" |
28 #include "base/metrics/field_trial.h" | 27 #include "base/metrics/field_trial.h" |
29 #include "base/metrics/histogram.h" | 28 #include "base/metrics/histogram.h" |
30 #include "base/path_service.h" | 29 #include "base/path_service.h" |
31 #include "base/process/process_handle.h" | 30 #include "base/process/process_handle.h" |
32 #include "base/rand_util.h" | 31 #include "base/rand_util.h" |
33 #include "base/stl_util.h" | 32 #include "base/stl_util.h" |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 | 911 |
913 void RenderProcessHostImpl::NotifyTimezoneChange() { | 912 void RenderProcessHostImpl::NotifyTimezoneChange() { |
914 Send(new ViewMsg_TimezoneChange()); | 913 Send(new ViewMsg_TimezoneChange()); |
915 } | 914 } |
916 | 915 |
917 ServiceRegistry* RenderProcessHostImpl::GetServiceRegistry() { | 916 ServiceRegistry* RenderProcessHostImpl::GetServiceRegistry() { |
918 DCHECK(mojo_application_host_); | 917 DCHECK(mojo_application_host_); |
919 return mojo_application_host_->service_registry(); | 918 return mojo_application_host_->service_registry(); |
920 } | 919 } |
921 | 920 |
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 | |
939 void RenderProcessHostImpl::AddRoute( | 921 void RenderProcessHostImpl::AddRoute( |
940 int32 routing_id, | 922 int32 routing_id, |
941 IPC::Listener* listener) { | 923 IPC::Listener* listener) { |
942 DebugInfoToCapture info(routing_id, GetID()); | 924 DCHECK(widget_helper_->IsRoutingIDProbablyValid(routing_id)) |
943 base::debug::Alias(&info); | 925 << "Found Routing ID conflicts: " << routing_id; |
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(); | |
949 listeners_.AddWithID(listener, routing_id); | 926 listeners_.AddWithID(listener, routing_id); |
950 } | 927 } |
951 | 928 |
952 void RenderProcessHostImpl::RemoveRoute(int32 routing_id) { | 929 void RenderProcessHostImpl::RemoveRoute(int32 routing_id) { |
953 DCHECK(listeners_.Lookup(routing_id) != NULL); | 930 DCHECK(listeners_.Lookup(routing_id) != NULL); |
954 listeners_.Remove(routing_id); | 931 listeners_.Remove(routing_id); |
955 | 932 |
956 #if defined(OS_WIN) | 933 #if defined(OS_WIN) |
957 // Dump the handle table if handle auditing is enabled. | 934 // Dump the handle table if handle auditing is enabled. |
958 const base::CommandLine& browser_command_line = | 935 const base::CommandLine& browser_command_line = |
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2275 if (worker_ref_count_ == 0) | 2252 if (worker_ref_count_ == 0) |
2276 Cleanup(); | 2253 Cleanup(); |
2277 } | 2254 } |
2278 | 2255 |
2279 void RenderProcessHostImpl::EnsureMojoActivated() { | 2256 void RenderProcessHostImpl::EnsureMojoActivated() { |
2280 mojo_activation_required_ = true; | 2257 mojo_activation_required_ = true; |
2281 MaybeActivateMojo(); | 2258 MaybeActivateMojo(); |
2282 } | 2259 } |
2283 | 2260 |
2284 } // namespace content | 2261 } // namespace content |
OLD | NEW |