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

Side by Side Diff: content/browser/indexed_db/leveldb/leveldb_database.cc

Issue 137423006: IndexedDB: fsync after transactions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changed to TODO Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/leveldb/leveldb_database.h" 5 #include "content/browser/indexed_db/leveldb/leveldb_database.h"
6 6
7 #include <cerrno> 7 #include <cerrno>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 16 matching lines...) Expand all
27 #include "third_party/leveldatabase/src/include/leveldb/slice.h" 27 #include "third_party/leveldatabase/src/include/leveldb/slice.h"
28 28
29 using base::StringPiece; 29 using base::StringPiece;
30 30
31 namespace content { 31 namespace content {
32 32
33 // Forcing flushes to disk at the end of a transaction guarantees that the 33 // Forcing flushes to disk at the end of a transaction guarantees that the
34 // data hit disk, but drastically impacts throughput when the filesystem is 34 // data hit disk, but drastically impacts throughput when the filesystem is
35 // busy with background compactions. Not syncing trades off reliability for 35 // busy with background compactions. Not syncing trades off reliability for
36 // performance. Note that background compactions which move data from the 36 // performance. Note that background compactions which move data from the
37 // log to SSTs are still done with reliable writes. 37 // log to SSTs are always done with reliable writes.
38 // 38 //
39 // Sync writes are necessary on Windows for quota calculations; POSIX 39 // Sync writes are necessary on Windows for quota calculations; POSIX
40 // calculates file sizes correctly even when not synced to disk. 40 // calculates file sizes correctly even when not synced to disk.
41 #if defined(OS_WIN) 41 #if defined(OS_WIN)
42 static const bool kSyncWrites = true; 42 static const bool kSyncWrites = true;
43 #else 43 #else
44 static const bool kSyncWrites = false; 44 // TODO(dgrogan): Either remove the #if block or change this back to false.
45 // See http://crbug.com/338385.
46 static const bool kSyncWrites = true;
45 #endif 47 #endif
46 48
47 static leveldb::Slice MakeSlice(const StringPiece& s) { 49 static leveldb::Slice MakeSlice(const StringPiece& s) {
48 return leveldb::Slice(s.begin(), s.size()); 50 return leveldb::Slice(s.begin(), s.size());
49 } 51 }
50 52
51 static StringPiece MakeStringPiece(const leveldb::Slice& s) { 53 static StringPiece MakeStringPiece(const leveldb::Slice& s) {
52 return StringPiece(s.data(), s.size()); 54 return StringPiece(s.data(), s.size());
53 } 55 }
54 56
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 459 }
458 460
459 void LevelDBDatabase::Compact(const base::StringPiece& start, 461 void LevelDBDatabase::Compact(const base::StringPiece& start,
460 const base::StringPiece& stop) { 462 const base::StringPiece& stop) {
461 const leveldb::Slice start_slice = MakeSlice(start); 463 const leveldb::Slice start_slice = MakeSlice(start);
462 const leveldb::Slice stop_slice = MakeSlice(stop); 464 const leveldb::Slice stop_slice = MakeSlice(stop);
463 db_->CompactRange(&start_slice, &stop_slice); 465 db_->CompactRange(&start_slice, &stop_slice);
464 } 466 }
465 467
466 } // namespace content 468 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698