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

Side by Side Diff: content/browser/indexed_db/indexed_db_database.cc

Issue 2233153002: IndexedDB: WrapUnique(new T(args..)) -> MakeUnique<T>(args...) (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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/indexed_db/indexed_db_database.h" 5 #include "content/browser/indexed_db/indexed_db_database.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 blink::WebIDBOperationType type, 789 blink::WebIDBOperationType type,
790 const IndexedDBKeyRange& key_range) { 790 const IndexedDBKeyRange& key_range) {
791 for (auto* connection : connections_) { 791 for (auto* connection : connections_) {
792 bool recorded = false; 792 bool recorded = false;
793 for (const auto& observer : connection->active_observers()) { 793 for (const auto& observer : connection->active_observers()) {
794 if (!observer->IsRecordingType(type) || 794 if (!observer->IsRecordingType(type) ||
795 !observer->IsRecordingObjectStore(object_store_id)) 795 !observer->IsRecordingObjectStore(object_store_id))
796 continue; 796 continue;
797 if (!recorded) { 797 if (!recorded) {
798 if (type == blink::WebIDBClear) { 798 if (type == blink::WebIDBClear) {
799 transaction->AddObservation(connection->id(), 799 transaction->AddObservation(
800 base::WrapUnique(new IndexedDBObservation( 800 connection->id(),
801 object_store_id, type))); 801 base::MakeUnique<IndexedDBObservation>(object_store_id, type));
802 } else { 802 } else {
803 transaction->AddObservation(connection->id(), 803 transaction->AddObservation(connection->id(),
804 base::WrapUnique(new IndexedDBObservation( 804 base::MakeUnique<IndexedDBObservation>(
805 object_store_id, type, key_range))); 805 object_store_id, type, key_range));
806 } 806 }
807 recorded = true; 807 recorded = true;
808 } 808 }
809 transaction->RecordObserverForLastObservation(connection->id(), 809 transaction->RecordObserverForLastObservation(connection->id(),
810 observer->id()); 810 observer->id());
811 } 811 }
812 } 812 }
813 } 813 }
814 814
815 void IndexedDBDatabase::SendObservations( 815 void IndexedDBDatabase::SendObservations(
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 const int64_t max_generator_value = 1165 const int64_t max_generator_value =
1166 9007199254740992LL; // Maximum integer storable as ECMAScript number. 1166 9007199254740992LL; // Maximum integer storable as ECMAScript number.
1167 int64_t current_number; 1167 int64_t current_number;
1168 leveldb::Status s = backing_store->GetKeyGeneratorCurrentNumber( 1168 leveldb::Status s = backing_store->GetKeyGeneratorCurrentNumber(
1169 transaction->BackingStoreTransaction(), 1169 transaction->BackingStoreTransaction(),
1170 database_id, 1170 database_id,
1171 object_store_id, 1171 object_store_id,
1172 &current_number); 1172 &current_number);
1173 if (!s.ok()) { 1173 if (!s.ok()) {
1174 LOG(ERROR) << "Failed to GetKeyGeneratorCurrentNumber"; 1174 LOG(ERROR) << "Failed to GetKeyGeneratorCurrentNumber";
1175 return base::WrapUnique(new IndexedDBKey()); 1175 return base::MakeUnique<IndexedDBKey>();
1176 } 1176 }
1177 if (current_number < 0 || current_number > max_generator_value) 1177 if (current_number < 0 || current_number > max_generator_value)
1178 return base::WrapUnique(new IndexedDBKey()); 1178 return base::MakeUnique<IndexedDBKey>();
1179 1179
1180 return base::WrapUnique( 1180 return base::MakeUnique<IndexedDBKey>(current_number, WebIDBKeyTypeNumber);
1181 new IndexedDBKey(current_number, WebIDBKeyTypeNumber));
1182 } 1181 }
1183 1182
1184 static leveldb::Status UpdateKeyGenerator(IndexedDBBackingStore* backing_store, 1183 static leveldb::Status UpdateKeyGenerator(IndexedDBBackingStore* backing_store,
1185 IndexedDBTransaction* transaction, 1184 IndexedDBTransaction* transaction,
1186 int64_t database_id, 1185 int64_t database_id,
1187 int64_t object_store_id, 1186 int64_t object_store_id,
1188 const IndexedDBKey& key, 1187 const IndexedDBKey& key,
1189 bool check_current) { 1188 bool check_current) {
1190 DCHECK_EQ(WebIDBKeyTypeNumber, key.type()); 1189 DCHECK_EQ(WebIDBKeyTypeNumber, key.type());
1191 return backing_store->MaybeUpdateKeyGeneratorCurrentNumber( 1190 return backing_store->MaybeUpdateKeyGeneratorCurrentNumber(
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 2003
2005 void IndexedDBDatabase::VersionChangeAbortOperation( 2004 void IndexedDBDatabase::VersionChangeAbortOperation(
2006 int64_t previous_version, 2005 int64_t previous_version,
2007 IndexedDBTransaction* transaction) { 2006 IndexedDBTransaction* transaction) {
2008 DCHECK(!transaction); 2007 DCHECK(!transaction);
2009 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); 2008 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation");
2010 metadata_.version = previous_version; 2009 metadata_.version = previous_version;
2011 } 2010 }
2012 2011
2013 } // namespace content 2012 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698