OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 BrowserContext::GetConnectorFor(browser_context_); | 927 BrowserContext::GetConnectorFor(browser_context_); |
928 if (!connector) { | 928 if (!connector) { |
929 // Note that some embedders (e.g. Android WebView) may not initialize a | 929 // Note that some embedders (e.g. Android WebView) may not initialize a |
930 // Connector per BrowserContext. In those cases we fall back to the | 930 // Connector per BrowserContext. In those cases we fall back to the |
931 // browser-wide Connector. | 931 // browser-wide Connector. |
932 if (!ServiceManagerConnection::GetForProcess()) { | 932 if (!ServiceManagerConnection::GetForProcess()) { |
933 // Additionally, some test code may not initialize the process-wide | 933 // Additionally, some test code may not initialize the process-wide |
934 // ServiceManagerConnection prior to this point. This class of test code | 934 // ServiceManagerConnection prior to this point. This class of test code |
935 // doesn't care about render processes, so we can initialize a dummy | 935 // doesn't care about render processes, so we can initialize a dummy |
936 // connection. | 936 // connection. |
937 service_manager::mojom::ServiceRequest request = | 937 service_manager::mojom::ServiceRequest request(&test_service_); |
938 mojo::MakeRequest(&test_service_); | |
939 ServiceManagerConnection::SetForProcess(ServiceManagerConnection::Create( | 938 ServiceManagerConnection::SetForProcess(ServiceManagerConnection::Create( |
940 std::move(request), io_task_runner)); | 939 std::move(request), io_task_runner)); |
941 } | 940 } |
942 connector = ServiceManagerConnection::GetForProcess()->GetConnector(); | 941 connector = ServiceManagerConnection::GetForProcess()->GetConnector(); |
943 } | 942 } |
944 | 943 |
945 // Establish a ServiceManager connection for the new render service instance. | 944 // Establish a ServiceManager connection for the new render service instance. |
946 child_connection_.reset(new ChildConnection( | 945 child_connection_.reset(new ChildConnection( |
947 mojom::kRendererServiceName, | 946 mojom::kRendererServiceName, |
948 base::StringPrintf("%d_%d", id_, instance_id_++), child_token_, connector, | 947 base::StringPrintf("%d_%d", id_, instance_id_++), child_token_, connector, |
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3022 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3021 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
3023 | 3022 |
3024 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. | 3023 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. |
3025 // Capture the error message in a crash key value. | 3024 // Capture the error message in a crash key value. |
3026 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); | 3025 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); |
3027 bad_message::ReceivedBadMessage(render_process_id, | 3026 bad_message::ReceivedBadMessage(render_process_id, |
3028 bad_message::RPH_MOJO_PROCESS_ERROR); | 3027 bad_message::RPH_MOJO_PROCESS_ERROR); |
3029 } | 3028 } |
3030 | 3029 |
3031 } // namespace content | 3030 } // namespace content |
OLD | NEW |