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

Unified Diff: content/browser/indexed_db/indexed_db_dispatcher_host.cc

Issue 2255853003: IndexedDB: ScopedVector<T> -> vector<unique_ptr<T>> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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: content/browser/indexed_db/indexed_db_dispatcher_host.cc
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.cc b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
index af11223de4649bb46aba4116a42c223230f77c1e..dc442bc3fe24d7567482ef832ab797c4580a1c49 100644
--- a/content/browser/indexed_db/indexed_db_dispatcher_host.cc
+++ b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
@@ -11,7 +11,6 @@
#include "base/files/file_path.h"
#include "base/guid.h"
#include "base/memory/ptr_util.h"
-#include "base/memory/scoped_vector.h"
#include "base/process/process.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -407,8 +406,8 @@ void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase(
// to the IndexedDBDispatcherHost.
void IndexedDBDispatcherHost::OnPutHelper(
const IndexedDBHostMsg_DatabasePut_Params& params,
- std::vector<storage::BlobDataHandle*> handles) {
- database_dispatcher_host_->OnPut(params, handles);
+ std::vector<std::unique_ptr<storage::BlobDataHandle>> handles) {
+ database_dispatcher_host_->OnPut(params, std::move(handles));
}
void IndexedDBDispatcherHost::OnAckReceivedBlobs(
@@ -711,24 +710,23 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnGetAll(
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPutWrapper(
const IndexedDBHostMsg_DatabasePut_Params& params) {
- std::vector<storage::BlobDataHandle*> handles;
- for (size_t i = 0; i < params.value.blob_or_file_info.size(); ++i) {
- const IndexedDBMsg_BlobOrFileInfo& info = params.value.blob_or_file_info[i];
- handles.push_back(parent_->blob_storage_context_->context()
- ->GetBlobDataFromUUID(info.uuid)
- .release());
+ std::vector<std::unique_ptr<storage::BlobDataHandle>> handles;
+ for (const auto& info : params.value.blob_or_file_info) {
+ handles.push_back(
+ parent_->blob_storage_context_->context()->GetBlobDataFromUUID(
+ info.uuid));
}
parent_->context()->TaskRunner()->PostTask(
FROM_HERE, base::Bind(&IndexedDBDispatcherHost::OnPutHelper, parent_,
- params, handles));
+ params, base::Passed(std::move(handles))));
cmumford 2016/08/17 20:26:29 If I'm reading bind_helpers.h correctly this could
jsbell 2016/08/17 23:16:19 Done.
}
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut(
const IndexedDBHostMsg_DatabasePut_Params& params,
- std::vector<storage::BlobDataHandle*> handles) {
+ std::vector<std::unique_ptr<storage::BlobDataHandle>> handles) {
DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread());
- ScopedVector<storage::BlobDataHandle> scoped_handles;
+ std::vector<std::unique_ptr<storage::BlobDataHandle>> scoped_handles;
scoped_handles.swap(handles);
IndexedDBConnection* connection =
@@ -747,8 +745,8 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut(
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
- for (size_t i = 0; i < params.value.blob_or_file_info.size(); ++i) {
- const IndexedDBMsg_BlobOrFileInfo& info = params.value.blob_or_file_info[i];
+ size_t i = 0;
+ for (const auto& info : params.value.blob_or_file_info) {
if (info.is_file) {
base::FilePath path;
if (!info.file_path.empty()) {
@@ -769,6 +767,7 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut(
} else {
blob_info[i] = IndexedDBBlobInfo(info.uuid, info.mime_type, info.size);
}
+ ++i;
}
// TODO(alecflett): Avoid a copy here.
« no previous file with comments | « content/browser/indexed_db/indexed_db_dispatcher_host.h ('k') | content/browser/indexed_db/indexed_db_fake_backing_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698