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

Unified Diff: chrome/utility/importer/firefox_importer_unittest_utils_mac.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
« no previous file with comments | « chrome/test/base/mojo_test_connector.cc ('k') | components/arc/arc_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/importer/firefox_importer_unittest_utils_mac.cc
diff --git a/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc b/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc
index 777a461ba2112d6fd87bea0ccc4194f0bcecf248..e94d6711cb0f393a4f93d0e80103a13d105f3328 100644
--- a/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc
+++ b/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc
@@ -28,6 +28,7 @@
#include "ipc/ipc_listener.h"
#include "ipc/ipc_message.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_platform_handle.h"
#include "testing/multiprocess_func_list.h"
@@ -146,27 +147,19 @@ bool FFUnitTestDecryptorProxy::Setup(const base::FilePath& nss_path) {
listener_.reset(new FFDecryptorServerChannelListener());
// Set up IPC channel using ChannelMojo.
- const std::string mojo_child_token = mojo::edk::GenerateRandomToken();
- const std::string mojo_channel_token = mojo::edk::GenerateRandomToken();
- mojo::ScopedMessagePipeHandle parent_handle =
- mojo::edk::CreateParentMessagePipe(mojo_channel_token, mojo_child_token);
- channel_ = IPC::Channel::CreateServer(parent_handle.release(),
- listener_.get());
+ mojo::edk::PendingProcessConnection process;
+ std::string token;
+ mojo::ScopedMessagePipeHandle parent_pipe = process.CreateMessagePipe(&token);
+ channel_ = IPC::Channel::CreateServer(parent_pipe.release(), listener_.get());
CHECK(channel_->Connect());
listener_->SetSender(channel_.get());
// Spawn child and set up sync IPC connection.
mojo::edk::PlatformChannelPair channel_pair;
child_process_ = LaunchNSSDecrypterChildProcess(
- nss_path, channel_pair.PassClientHandle(), mojo_channel_token);
- if (child_process_.IsValid()) {
- mojo::edk::ChildProcessLaunched(child_process_.Handle(),
- channel_pair.PassServerHandle(),
- mojo_child_token);
- } else {
- mojo::edk::ChildProcessLaunchFailed(mojo_child_token);
- }
-
+ nss_path, channel_pair.PassClientHandle(), token);
+ if (child_process_.IsValid())
+ process.Connect(child_process_.Handle(), channel_pair.PassServerHandle());
return child_process_.IsValid();
}
« no previous file with comments | « chrome/test/base/mojo_test_connector.cc ('k') | components/arc/arc_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698