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

Unified Diff: mojo/edk/system/platform_handle_dispatcher.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/platform_handle_dispatcher.h ('k') | mojo/edk/system/raw_channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/platform_handle_dispatcher.cc
diff --git a/mojo/edk/system/platform_handle_dispatcher.cc b/mojo/edk/system/platform_handle_dispatcher.cc
index 91c64fd8956d39df190ef8ddeff01c15fd0c6a77..7cb711074e9870cfb1971c49c07b470456abdb67 100644
--- a/mojo/edk/system/platform_handle_dispatcher.cc
+++ b/mojo/edk/system/platform_handle_dispatcher.cc
@@ -5,9 +5,11 @@
#include "mojo/edk/system/platform_handle_dispatcher.h"
#include <algorithm>
+#include <utility>
#include "base/logging.h"
+using mojo::embedder::ScopedPlatformHandle;
using mojo::util::MutexLocker;
using mojo::util::RefPtr;
@@ -24,7 +26,7 @@ struct SerializedPlatformHandleDispatcher {
} // namespace
-embedder::ScopedPlatformHandle PlatformHandleDispatcher::PassPlatformHandle() {
+ScopedPlatformHandle PlatformHandleDispatcher::PassPlatformHandle() {
MutexLocker locker(&mutex());
return platform_handle_.Pass();
}
@@ -38,7 +40,7 @@ RefPtr<PlatformHandleDispatcher> PlatformHandleDispatcher::Deserialize(
Channel* channel,
const void* source,
size_t size,
- embedder::PlatformHandleVector* platform_handles) {
+ std::vector<ScopedPlatformHandle>* platform_handles) {
if (size != sizeof(SerializedPlatformHandleDispatcher)) {
LOG(ERROR) << "Invalid serialized platform handle dispatcher (bad size)";
return nullptr;
@@ -49,7 +51,7 @@ RefPtr<PlatformHandleDispatcher> PlatformHandleDispatcher::Deserialize(
size_t platform_handle_index = serialization->platform_handle_index;
// Starts off invalid, which is what we want.
- embedder::PlatformHandle platform_handle;
+ ScopedPlatformHandle platform_handle;
if (platform_handle_index != kInvalidPlatformHandleIndex) {
if (!platform_handles ||
@@ -64,13 +66,12 @@ RefPtr<PlatformHandleDispatcher> PlatformHandleDispatcher::Deserialize(
std::swap(platform_handle, (*platform_handles)[platform_handle_index]);
}
- return Create(embedder::ScopedPlatformHandle(platform_handle));
+ return Create(std::move(platform_handle));
}
PlatformHandleDispatcher::PlatformHandleDispatcher(
- embedder::ScopedPlatformHandle platform_handle)
- : platform_handle_(platform_handle.Pass()) {
-}
+ ScopedPlatformHandle platform_handle)
+ : platform_handle_(platform_handle.Pass()) {}
PlatformHandleDispatcher::~PlatformHandleDispatcher() {
}
@@ -99,14 +100,14 @@ bool PlatformHandleDispatcher::EndSerializeAndCloseImplNoLock(
Channel* /*channel*/,
void* destination,
size_t* actual_size,
- embedder::PlatformHandleVector* platform_handles) {
+ std::vector<ScopedPlatformHandle>* platform_handles) {
AssertHasOneRef(); // Only one ref => no need to take the lock.
SerializedPlatformHandleDispatcher* serialization =
static_cast<SerializedPlatformHandleDispatcher*>(destination);
if (platform_handle_.is_valid()) {
serialization->platform_handle_index = platform_handles->size();
- platform_handles->push_back(platform_handle_.release());
+ platform_handles->push_back(std::move(platform_handle_));
} else {
serialization->platform_handle_index = kInvalidPlatformHandleIndex;
}
« no previous file with comments | « mojo/edk/system/platform_handle_dispatcher.h ('k') | mojo/edk/system/raw_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698