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

Unified Diff: content/browser/indexed_db/leveldb/leveldb_slice.h

Issue 16256014: IndexedDB: Convert decoding functions to pass StringPieces vs. pointers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Correct bogus iterator dereference in unit test Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/leveldb/leveldb_slice.h
diff --git a/content/browser/indexed_db/leveldb/leveldb_slice.h b/content/browser/indexed_db/leveldb/leveldb_slice.h
index 302c0b6b8ca47a0e51127fc0ed638dde4eabbf6e..cb38bec143bbc16b38aa84f475029d0b1b578e83 100644
--- a/content/browser/indexed_db/leveldb/leveldb_slice.h
+++ b/content/browser/indexed_db/leveldb/leveldb_slice.h
@@ -8,6 +8,7 @@
#include <vector>
#include "base/logging.h"
+#include "base/strings/string_piece.h"
namespace content {
@@ -22,11 +23,20 @@ class LevelDBSlice {
DCHECK_GE(end_, begin_);
}
+ explicit LevelDBSlice(const std::string& v)
+ : begin_(v.data()), end_(v.data() + v.size()) {
+ DCHECK_GE(end_, begin_);
+ }
+
~LevelDBSlice() {}
const char* begin() const { return begin_; }
const char* end() const { return end_; }
+ base::StringPiece AsStringPiece() const {
+ return base::StringPiece(begin_, end_ - begin_);
+ }
+
private:
const char* begin_;
const char* end_;
« no previous file with comments | « content/browser/indexed_db/leveldb/leveldb_database.cc ('k') | content/browser/indexed_db/leveldb/leveldb_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698