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

Side by Side Diff: content/browser/cache_storage/cache_storage_cache.cc

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: Rebase Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/cache_storage/cache_storage_cache.h" 5 #include "content/browser/cache_storage/cache_storage_cache.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 UpdateCacheSize(); 1124 UpdateCacheSize();
1125 put_context->callback.Run(CACHE_STORAGE_OK); 1125 put_context->callback.Run(CACHE_STORAGE_OK);
1126 return; 1126 return;
1127 } 1127 }
1128 1128
1129 DCHECK(put_context->blob_data_handle); 1129 DCHECK(put_context->blob_data_handle);
1130 1130
1131 disk_cache::ScopedEntryPtr entry(std::move(put_context->cache_entry)); 1131 disk_cache::ScopedEntryPtr entry(std::move(put_context->cache_entry));
1132 put_context->cache_entry = NULL; 1132 put_context->cache_entry = NULL;
1133 1133
1134 CacheStorageBlobToDiskCache* blob_to_cache = 1134 std::unique_ptr<CacheStorageBlobToDiskCache> blob_to_cache =
danakj 2016/11/30 00:34:00 can auto
1135 new CacheStorageBlobToDiskCache(); 1135 base::MakeUnique<CacheStorageBlobToDiskCache>();
1136 CacheStorageBlobToDiskCache* blob_to_cache_raw = blob_to_cache.get();
1136 BlobToDiskCacheIDMap::KeyType blob_to_cache_key = 1137 BlobToDiskCacheIDMap::KeyType blob_to_cache_key =
1137 active_blob_to_disk_cache_writers_.Add(blob_to_cache); 1138 active_blob_to_disk_cache_writers_.Add(std::move(blob_to_cache));
1138 1139
1139 std::unique_ptr<storage::BlobDataHandle> blob_data_handle = 1140 std::unique_ptr<storage::BlobDataHandle> blob_data_handle =
1140 std::move(put_context->blob_data_handle); 1141 std::move(put_context->blob_data_handle);
1141 1142
1142 blob_to_cache->StreamBlobToCache( 1143 blob_to_cache_raw->StreamBlobToCache(
1143 std::move(entry), INDEX_RESPONSE_BODY, request_context_getter_.get(), 1144 std::move(entry), INDEX_RESPONSE_BODY, request_context_getter_.get(),
1144 std::move(blob_data_handle), 1145 std::move(blob_data_handle),
1145 base::Bind(&CacheStorageCache::PutDidWriteBlobToCache, 1146 base::Bind(&CacheStorageCache::PutDidWriteBlobToCache,
1146 weak_ptr_factory_.GetWeakPtr(), 1147 weak_ptr_factory_.GetWeakPtr(),
1147 base::Passed(std::move(put_context)), blob_to_cache_key)); 1148 base::Passed(std::move(put_context)), blob_to_cache_key));
1148 } 1149 }
1149 1150
1150 void CacheStorageCache::PutDidWriteBlobToCache( 1151 void CacheStorageCache::PutDidWriteBlobToCache(
1151 std::unique_ptr<PutContext> put_context, 1152 std::unique_ptr<PutContext> put_context,
1152 BlobToDiskCacheIDMap::KeyType blob_to_cache_key, 1153 BlobToDiskCacheIDMap::KeyType blob_to_cache_key,
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); 1444 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA);
1444 return blob_storage_context_->AddFinishedBlob(&blob_data); 1445 return blob_storage_context_->AddFinishedBlob(&blob_data);
1445 } 1446 }
1446 1447
1447 std::unique_ptr<CacheStorageCacheHandle> 1448 std::unique_ptr<CacheStorageCacheHandle>
1448 CacheStorageCache::CreateCacheHandle() { 1449 CacheStorageCache::CreateCacheHandle() {
1449 return cache_storage_->CreateCacheHandle(this); 1450 return cache_storage_->CreateCacheHandle(this);
1450 } 1451 }
1451 1452
1452 } // namespace content 1453 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698