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

Side by Side Diff: content/browser/leveldb_wrapper_impl.cc

Issue 2604963002: Store per-origin metadata for localstorage. (Closed)
Patch Set: remove duplicate include line Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/leveldb_wrapper_impl.h" 5 #include "content/browser/leveldb_wrapper_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "components/leveldb/public/cpp/util.h" 9 #include "components/leveldb/public/cpp/util.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 void LevelDBWrapperImpl::CommitChanges() { 330 void LevelDBWrapperImpl::CommitChanges() {
331 DCHECK(database_); 331 DCHECK(database_);
332 DCHECK(map_); 332 DCHECK(map_);
333 if (!commit_batch_) 333 if (!commit_batch_)
334 return; 334 return;
335 335
336 commit_rate_limiter_.add_samples(1); 336 commit_rate_limiter_.add_samples(1);
337 337
338 // Commit all our changes in a single batch. 338 // Commit all our changes in a single batch.
339 std::vector<leveldb::mojom::BatchedOperationPtr> operations = 339 std::vector<leveldb::mojom::BatchedOperationPtr> operations =
340 prepare_to_commit_callback_.Run(); 340 prepare_to_commit_callback_.Run(*this);
341 if (commit_batch_->clear_all_first) { 341 if (commit_batch_->clear_all_first) {
342 leveldb::mojom::BatchedOperationPtr item = 342 leveldb::mojom::BatchedOperationPtr item =
343 leveldb::mojom::BatchedOperation::New(); 343 leveldb::mojom::BatchedOperation::New();
344 item->type = leveldb::mojom::BatchOperationType::DELETE_PREFIXED_KEY; 344 item->type = leveldb::mojom::BatchOperationType::DELETE_PREFIXED_KEY;
345 item->key = prefix_; 345 item->key = prefix_;
346 operations.push_back(std::move(item)); 346 operations.push_back(std::move(item));
347 } 347 }
348 size_t data_size = 0; 348 size_t data_size = 0;
349 for (const auto& key: commit_batch_->changed_keys) { 349 for (const auto& key: commit_batch_->changed_keys) {
350 data_size += key.size(); 350 data_size += key.size();
(...skipping 25 matching lines...) Expand all
376 weak_ptr_factory_.GetWeakPtr())); 376 weak_ptr_factory_.GetWeakPtr()));
377 } 377 }
378 378
379 void LevelDBWrapperImpl::OnCommitComplete(leveldb::mojom::DatabaseError error) { 379 void LevelDBWrapperImpl::OnCommitComplete(leveldb::mojom::DatabaseError error) {
380 // TODO(michaeln): What if it fails, uma here or in the DB class? 380 // TODO(michaeln): What if it fails, uma here or in the DB class?
381 --commit_batches_in_flight_; 381 --commit_batches_in_flight_;
382 StartCommitTimer(); 382 StartCommitTimer();
383 } 383 }
384 384
385 } // namespace content 385 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/leveldb_wrapper_impl.h ('k') | content/browser/leveldb_wrapper_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698