Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: content/browser/utility_process_host_impl.cc

Issue 862813002: WIP: Prototype OOP V8 PAC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Slight cleanup and report JS memory usage. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/utility_process_host_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/utility_process_host_impl.cc
diff --git a/content/browser/utility_process_host_impl.cc b/content/browser/utility_process_host_impl.cc
index 6f6eb37997259d20b444b1187c6bd6c43466b25f..d2fb39638fc1acd74e8c600d7cad0928e298ecb7 100644
--- a/content/browser/utility_process_host_impl.cc
+++ b/content/browser/utility_process_host_impl.cc
@@ -9,12 +9,14 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/message_loop/message_loop.h"
+#include "base/process/process_handle.h"
#include "base/run_loop.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
#include "content/browser/browser_child_process_host_impl.h"
+#include "content/browser/mojo/mojo_application_host.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/common/child_process_host_impl.h"
#include "content/common/utility_messages.h"
@@ -166,6 +168,14 @@ void UtilityProcessHostImpl::SetEnv(const base::EnvironmentMap& env) {
#endif // OS_POSIX
+bool UtilityProcessHostImpl::StartMojoMode() {
+ return StartProcess();
+}
+
+ServiceRegistry* UtilityProcessHostImpl::GetServiceRegistry() {
+ return mojo_application_host_.service_registry();
+}
+
bool UtilityProcessHostImpl::StartProcess() {
if (started_)
return true;
@@ -174,10 +184,13 @@ bool UtilityProcessHostImpl::StartProcess() {
if (is_batch_mode_)
return true;
+ CHECK(mojo_application_host_.Init()) << "Unable to initialize Mojo host.";
+
// Name must be set or metrics_service will crash in any test which
// launches a UtilityProcessHost.
process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_UTILITY, this));
process_->SetName(base::ASCIIToUTF16("utility process"));
+ process_->SetServiceRegistry(GetServiceRegistry());
std::string channel_id = process_->GetHost()->CreateChannel();
if (channel_id.empty())
@@ -293,4 +306,14 @@ void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) {
exit_code));
}
+void UtilityProcessHostImpl::OnProcessLaunched() {
+ base::ProcessHandle handle;
+ if (RenderProcessHost::run_renderer_in_process())
+ handle = base::GetCurrentProcessHandle();
+ else
+ handle = process_->GetData().handle;
+
+ mojo_application_host_.Activate(this, handle);
+}
+
} // namespace content
« no previous file with comments | « content/browser/utility_process_host_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698