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

Unified Diff: chrome/test/base/mojo_test_connector.cc

Issue 2680973006: Mojo EDK: Add safe process connection API (Closed)
Patch Set: . Created 3 years, 10 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
Index: chrome/test/base/mojo_test_connector.cc
diff --git a/chrome/test/base/mojo_test_connector.cc b/chrome/test/base/mojo_test_connector.cc
index 2c7e92ade6b207f95ca9d6f42c1c8347caae0312..f1bcee2f4a9c616b6641652ce07a2369c8eeaf58 100644
--- a/chrome/test/base/mojo_test_connector.cc
+++ b/chrome/test/base/mojo_test_connector.cc
@@ -17,6 +17,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/test/test_launcher.h"
#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/pending_process_connection.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
#include "mojo/edk/embedder/scoped_ipc_support.h"
#include "mojo/public/cpp/bindings/interface_request.h"
@@ -42,8 +43,7 @@ class MojoTestState : public content::TestState {
public:
explicit MojoTestState(
service_manager::BackgroundServiceManager* background_service_manager)
- : child_token_(mojo::edk::GenerateRandomToken()),
- background_service_manager_(background_service_manager),
+ : background_service_manager_(background_service_manager),
weak_factory_(this) {}
~MojoTestState() override {}
@@ -68,8 +68,8 @@ class MojoTestState : public content::TestState {
#error "Unsupported"
#endif
service_manager::mojom::ServicePtr service =
- service_manager::PassServiceRequestOnCommandLine(command_line,
- child_token_);
+ service_manager::PassServiceRequestOnCommandLine(&process_connection_,
+ command_line);
background_service_manager_->RegisterService(
service_manager::Identity(
@@ -87,8 +87,7 @@ class MojoTestState : public content::TestState {
void ChildProcessLaunched(base::ProcessHandle handle,
base::ProcessId pid) override {
platform_channel_->ChildProcessLaunched();
- mojo::edk::ChildProcessLaunched(
- handle, platform_channel_->PassServerHandle(), child_token_);
+ process_connection_.Connect(handle, platform_channel_->PassServerHandle());
main_task_runner_->PostTask(
FROM_HERE,
@@ -102,7 +101,7 @@ class MojoTestState : public content::TestState {
pid_receiver_.reset();
}
- const std::string child_token_;
+ mojo::edk::PendingProcessConnection process_connection_;
service_manager::BackgroundServiceManager* const background_service_manager_;
// NOTE: HandlePassingInformation must remain valid through process launch,
« no previous file with comments | « chrome/service/service_utility_process_host.cc ('k') | chrome/utility/importer/firefox_importer_unittest_utils_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698