summaryrefslogtreecommitdiffstats
path: root/extensions/browser/mojo
diff options
context:
space:
mode:
authorlimasdf <limasdf@gmail.com>2015-11-13 14:16:04 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-13 22:17:09 +0000
commit6ca2e3c43a9b03699b6858b4ed424312a22db107 (patch)
tree637367b7c4c525e8fc74c9dfd77777b38cf9834b /extensions/browser/mojo
parentc8726de85c7d5e4855fc5db9c7e380273cae4477 (diff)
downloadchromium_src-6ca2e3c43a9b03699b6858b4ed424312a22db107.zip
chromium_src-6ca2e3c43a9b03699b6858b4ed424312a22db107.tar.gz
chromium_src-6ca2e3c43a9b03699b6858b4ed424312a22db107.tar.bz2
Remove ScopedVector from /extenisons part#1
C++ 11 enables containers that contain move-only type, scoped_ptr. So, Use std::vector<scoped_ptr<Foo>> instead of ScopedVector. BUG=554289 TEST=none Review URL: https://codereview.chromium.org/1445543002 Cr-Commit-Position: refs/heads/master@{#359663}
Diffstat (limited to 'extensions/browser/mojo')
-rw-r--r--extensions/browser/mojo/stash_backend.cc18
-rw-r--r--extensions/browser/mojo/stash_backend.h5
2 files changed, 13 insertions, 10 deletions
diff --git a/extensions/browser/mojo/stash_backend.cc b/extensions/browser/mojo/stash_backend.cc
index 74f4bfc..381142d 100644
--- a/extensions/browser/mojo/stash_backend.cc
+++ b/extensions/browser/mojo/stash_backend.cc
@@ -4,6 +4,8 @@
#include "extensions/browser/mojo/stash_backend.h"
+#include <vector>
+
#include "base/bind.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/environment/async_waiter.h"
@@ -79,7 +81,7 @@ class StashBackend::StashEntry {
void OnHandleReady(MojoResult result);
// The waiters that are waiting for handles to be readable.
- ScopedVector<mojo::AsyncWaiter> waiters_;
+ std::vector<scoped_ptr<mojo::AsyncWaiter>> waiters_;
StashedObjectPtr stashed_object_;
@@ -99,11 +101,11 @@ StashBackend::~StashBackend() {
void StashBackend::AddToStash(mojo::Array<StashedObjectPtr> stashed_objects) {
for (size_t i = 0; i < stashed_objects.size(); i++) {
- stashed_objects_.push_back(
- new StashEntry(stashed_objects[i].Pass(),
- has_notified_ ? base::Closure()
- : base::Bind(&StashBackend::OnHandleReady,
- weak_factory_.GetWeakPtr())));
+ stashed_objects_.push_back(make_scoped_ptr(new StashEntry(
+ stashed_objects[i].Pass(),
+ has_notified_ ? base::Closure()
+ : base::Bind(&StashBackend::OnHandleReady,
+ weak_factory_.GetWeakPtr()))));
}
}
@@ -139,10 +141,10 @@ StashBackend::StashEntry::StashEntry(StashedObjectPtr stashed_object,
return;
for (size_t i = 0; i < stashed_object_->stashed_handles.size(); i++) {
- waiters_.push_back(new mojo::AsyncWaiter(
+ waiters_.push_back(make_scoped_ptr(new mojo::AsyncWaiter(
stashed_object_->stashed_handles[i].get(), MOJO_HANDLE_SIGNAL_READABLE,
base::Bind(&StashBackend::StashEntry::OnHandleReady,
- base::Unretained(this))));
+ base::Unretained(this)))));
}
}
diff --git a/extensions/browser/mojo/stash_backend.h b/extensions/browser/mojo/stash_backend.h
index 27f17a6..e9fdf26 100644
--- a/extensions/browser/mojo/stash_backend.h
+++ b/extensions/browser/mojo/stash_backend.h
@@ -5,8 +5,9 @@
#ifndef EXTENSIONS_BROWSER_MOJO_STASH_BACKEND_H_
#define EXTENSIONS_BROWSER_MOJO_STASH_BACKEND_H_
+#include <vector>
+
#include "base/callback.h"
-#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "extensions/common/mojo/stash.mojom.h"
#include "mojo/public/cpp/bindings/interface_request.h"
@@ -37,7 +38,7 @@ class StashBackend {
void OnHandleReady();
// The objects that have been stashed.
- ScopedVector<StashEntry> stashed_objects_;
+ std::vector<scoped_ptr<StashEntry>> stashed_objects_;
// The callback to call when a handle is readable.
const base::Closure on_handle_readable_;