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

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

Issue 2228403003: content: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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_backing_store.h" 5 #include "content/browser/indexed_db/indexed_db_backing_store.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 active_blob_registry_(this), 763 active_blob_registry_(this),
764 committing_transaction_count_(0) {} 764 committing_transaction_count_(0) {}
765 765
766 IndexedDBBackingStore::~IndexedDBBackingStore() { 766 IndexedDBBackingStore::~IndexedDBBackingStore() {
767 if (!blob_path_.empty() && !child_process_ids_granted_.empty()) { 767 if (!blob_path_.empty() && !child_process_ids_granted_.empty()) {
768 ChildProcessSecurityPolicyImpl* policy = 768 ChildProcessSecurityPolicyImpl* policy =
769 ChildProcessSecurityPolicyImpl::GetInstance(); 769 ChildProcessSecurityPolicyImpl::GetInstance();
770 for (const auto& pid : child_process_ids_granted_) 770 for (const auto& pid : child_process_ids_granted_)
771 policy->RevokeAllPermissionsForFile(pid, blob_path_); 771 policy->RevokeAllPermissionsForFile(pid, blob_path_);
772 } 772 }
773 STLDeleteContainerPairSecondPointers(incognito_blob_map_.begin(), 773 base::STLDeleteContainerPairSecondPointers(incognito_blob_map_.begin(),
774 incognito_blob_map_.end()); 774 incognito_blob_map_.end());
775 // db_'s destructor uses comparator_. The order of destruction is important. 775 // db_'s destructor uses comparator_. The order of destruction is important.
776 db_.reset(); 776 db_.reset();
777 comparator_.reset(); 777 comparator_.reset();
778 } 778 }
779 779
780 IndexedDBBackingStore::RecordIdentifier::RecordIdentifier( 780 IndexedDBBackingStore::RecordIdentifier::RecordIdentifier(
781 const std::string& primary_key, 781 const std::string& primary_key,
782 int64_t version) 782 int64_t version)
783 : primary_key_(primary_key), version_(version) { 783 : primary_key_(primary_key), version_(version) {
784 DCHECK(!primary_key.empty()); 784 DCHECK(!primary_key.empty());
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 return false; 910 return false;
911 if (!file_size) { 911 if (!file_size) {
912 NOTREACHED(); 912 NOTREACHED();
913 return false; 913 return false;
914 } 914 }
915 915
916 base::File file(info_path, base::File::FLAG_OPEN | base::File::FLAG_READ); 916 base::File file(info_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
917 bool success = false; 917 bool success = false;
918 if (file.IsValid()) { 918 if (file.IsValid()) {
919 std::string input_js(file_size, '\0'); 919 std::string input_js(file_size, '\0');
920 if (file_size == file.Read(0, string_as_array(&input_js), file_size)) { 920 if (file_size ==
921 file.Read(0, base::string_as_array(&input_js), file_size)) {
921 base::JSONReader reader; 922 base::JSONReader reader;
922 std::unique_ptr<base::DictionaryValue> val( 923 std::unique_ptr<base::DictionaryValue> val(
923 base::DictionaryValue::From(reader.ReadToValue(input_js))); 924 base::DictionaryValue::From(reader.ReadToValue(input_js)));
924 success = val->GetString("message", message); 925 success = val->GetString("message", message);
925 } 926 }
926 file.Close(); 927 file.Close();
927 } 928 }
928 929
929 base::DeleteFile(info_path, false); 930 base::DeleteFile(info_path, false);
930 931
(...skipping 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after
3998 3999
3999 return std::move(cursor); 4000 return std::move(cursor);
4000 } 4001 }
4001 4002
4002 IndexedDBBackingStore::Transaction::Transaction( 4003 IndexedDBBackingStore::Transaction::Transaction(
4003 IndexedDBBackingStore* backing_store) 4004 IndexedDBBackingStore* backing_store)
4004 : backing_store_(backing_store), database_id_(-1), committing_(false) { 4005 : backing_store_(backing_store), database_id_(-1), committing_(false) {
4005 } 4006 }
4006 4007
4007 IndexedDBBackingStore::Transaction::~Transaction() { 4008 IndexedDBBackingStore::Transaction::~Transaction() {
4008 STLDeleteContainerPairSecondPointers( 4009 base::STLDeleteContainerPairSecondPointers(blob_change_map_.begin(),
4009 blob_change_map_.begin(), blob_change_map_.end()); 4010 blob_change_map_.end());
4010 STLDeleteContainerPairSecondPointers(incognito_blob_map_.begin(), 4011 base::STLDeleteContainerPairSecondPointers(incognito_blob_map_.begin(),
4011 incognito_blob_map_.end()); 4012 incognito_blob_map_.end());
4012 DCHECK(!committing_); 4013 DCHECK(!committing_);
4013 } 4014 }
4014 4015
4015 void IndexedDBBackingStore::Transaction::Begin() { 4016 void IndexedDBBackingStore::Transaction::Begin() {
4016 IDB_TRACE("IndexedDBBackingStore::Transaction::Begin"); 4017 IDB_TRACE("IndexedDBBackingStore::Transaction::Begin");
4017 DCHECK(!transaction_.get()); 4018 DCHECK(!transaction_.get());
4018 transaction_ = IndexedDBClassFactory::Get()->CreateLevelDBTransaction( 4019 transaction_ = IndexedDBClassFactory::Get()->CreateLevelDBTransaction(
4019 backing_store_->db_.get()); 4020 backing_store_->db_.get());
4020 4021
4021 // If incognito, this snapshots blobs just as the above transaction_ 4022 // If incognito, this snapshots blobs just as the above transaction_
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
4467 4468
4468 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( 4469 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor(
4469 const WriteDescriptor& other) = default; 4470 const WriteDescriptor& other) = default;
4470 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() = 4471 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() =
4471 default; 4472 default;
4472 IndexedDBBackingStore::Transaction::WriteDescriptor& 4473 IndexedDBBackingStore::Transaction::WriteDescriptor&
4473 IndexedDBBackingStore::Transaction::WriteDescriptor:: 4474 IndexedDBBackingStore::Transaction::WriteDescriptor::
4474 operator=(const WriteDescriptor& other) = default; 4475 operator=(const WriteDescriptor& other) = default;
4475 4476
4476 } // namespace content 4477 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_active_blob_registry.cc ('k') | content/browser/indexed_db/indexed_db_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698