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

Unified Diff: mojo/edk/system/master_connection_manager.cc

Issue 1478503003: EDK: Convert most uses of PlatformHandleVector to std::vector<ScopedPlatformHandle>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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 | « mojo/edk/system/local_data_pipe_impl.cc ('k') | mojo/edk/system/message_pipe.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/master_connection_manager.cc
diff --git a/mojo/edk/system/master_connection_manager.cc b/mojo/edk/system/master_connection_manager.cc
index 4e78897a6c59f723de6bba091ea917b915ef4ca6..19f2d5dd645dc76c858042bbb93d3f9add9a448d 100644
--- a/mojo/edk/system/master_connection_manager.cc
+++ b/mojo/edk/system/master_connection_manager.cc
@@ -7,6 +7,7 @@
#include <memory>
#include <unordered_map>
#include <utility>
+#include <vector>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -17,6 +18,7 @@
#include "mojo/edk/embedder/platform_channel_pair.h"
#include "mojo/edk/embedder/platform_handle.h"
#include "mojo/edk/embedder/platform_handle_vector.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
#include "mojo/edk/system/connection_manager_messages.h"
#include "mojo/edk/system/message_in_transit.h"
#include "mojo/edk/system/raw_channel.h"
@@ -25,8 +27,10 @@
#include "mojo/edk/util/waitable_event.h"
#include "mojo/public/cpp/system/macros.h"
+using mojo::embedder::ScopedPlatformHandle;
using mojo::platform::TaskRunner;
using mojo::util::AutoResetWaitableEvent;
+using mojo::util::MakeUnique;
using mojo::util::MutexLocker;
using mojo::util::RefPtr;
@@ -84,9 +88,9 @@ class MasterConnectionManager::Helper final : public RawChannel::Delegate {
private:
// |RawChannel::Delegate| methods:
- void OnReadMessage(
- const MessageInTransit::View& message_view,
- embedder::ScopedPlatformHandleVectorPtr platform_handles) override;
+ void OnReadMessage(const MessageInTransit::View& message_view,
+ std::unique_ptr<std::vector<ScopedPlatformHandle>>
+ platform_handles) override;
void OnError(Error error) override;
// Handles an error that's fatal to this object. Note that this probably
@@ -129,7 +133,7 @@ embedder::SlaveInfo MasterConnectionManager::Helper::Shutdown() {
void MasterConnectionManager::Helper::OnReadMessage(
const MessageInTransit::View& message_view,
- embedder::ScopedPlatformHandleVectorPtr platform_handles) {
+ std::unique_ptr<std::vector<ScopedPlatformHandle>> platform_handles) {
if (message_view.type() != MessageInTransit::Type::CONNECTION_MANAGER) {
LOG(ERROR) << "Invalid message type " << message_view.type();
FatalError(); // WARNING: This destroys us.
@@ -199,9 +203,8 @@ void MasterConnectionManager::Helper::OnReadMessage(
DCHECK_EQ(message_view.subtype(),
MessageInTransit::Subtype::CONNECTION_MANAGER_CONNECT);
DCHECK(platform_handle.is_valid());
- embedder::ScopedPlatformHandleVectorPtr platform_handles(
- new embedder::PlatformHandleVector());
- platform_handles->push_back(platform_handle.release());
+ auto platform_handles = MakeUnique<std::vector<ScopedPlatformHandle>>();
+ platform_handles->push_back(std::move(platform_handle));
response->SetTransportData(util::MakeUnique<TransportData>(
std::move(platform_handles),
raw_channel_->GetSerializedPlatformHandleSize()));
@@ -317,6 +320,7 @@ class MasterConnectionManager::ProcessConnections {
}
private:
+ // TODO(vtl): Make |second| |ScopedPlatformHandle|s.
std::unordered_map<ProcessIdentifier, embedder::PlatformHandle>
process_connections_; // "Owns" any valid platform handles.
« no previous file with comments | « mojo/edk/system/local_data_pipe_impl.cc ('k') | mojo/edk/system/message_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698