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

Side by Side Diff: chrome/browser/android/history_report/delta_file_backend_leveldb.cc

Issue 2624583002: Remove redundant c_str() calls. (Closed)
Patch Set: Revert some changes Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/android/history_report/delta_file_backend_leveldb.h" 5 #include "chrome/browser/android/history_report/delta_file_backend_leveldb.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return false; 112 return false;
113 } 113 }
114 114
115 bool DeltaFileBackend::EnsureInitialized() { 115 bool DeltaFileBackend::EnsureInitialized() {
116 if (db_.get()) return true; 116 if (db_.get()) return true;
117 return Init(); 117 return Init();
118 } 118 }
119 119
120 void DeltaFileBackend::PageAdded(const GURL& url) { 120 void DeltaFileBackend::PageAdded(const GURL& url) {
121 if (!EnsureInitialized()) return; 121 if (!EnsureInitialized()) return;
122 SaveChange(db_.get(), url.spec().c_str(), "add"); 122 SaveChange(db_.get(), url.spec(), "add");
123 } 123 }
124 124
125 void DeltaFileBackend::PageDeleted(const GURL& url) { 125 void DeltaFileBackend::PageDeleted(const GURL& url) {
126 if (!EnsureInitialized()) return; 126 if (!EnsureInitialized()) return;
127 SaveChange(db_.get(), url.spec().c_str(), "del"); 127 SaveChange(db_.get(), url.spec(), "del");
128 } 128 }
129 129
130 int64_t DeltaFileBackend::Trim(int64_t lower_bound) { 130 int64_t DeltaFileBackend::Trim(int64_t lower_bound) {
131 if (!EnsureInitialized()) return -1; 131 if (!EnsureInitialized()) return -1;
132 leveldb::ReadOptions read_options; 132 leveldb::ReadOptions read_options;
133 std::unique_ptr<leveldb::Iterator> db_iter(db_->NewIterator(read_options)); 133 std::unique_ptr<leveldb::Iterator> db_iter(db_->NewIterator(read_options));
134 db_iter->SeekToFirst(); 134 db_iter->SeekToFirst();
135 if (!db_iter->Valid()) 135 if (!db_iter->Valid())
136 return -1; 136 return -1;
137 history_report::DeltaFileEntry first_entry; 137 history_report::DeltaFileEntry first_entry;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 leveldb::ReadOptions options; 232 leveldb::ReadOptions options;
233 std::unique_ptr<leveldb::Iterator> db_it(db_->NewIterator(options)); 233 std::unique_ptr<leveldb::Iterator> db_it(db_->NewIterator(options));
234 int num_entries = 0; 234 int num_entries = 0;
235 for (db_it->SeekToFirst(); db_it->Valid(); db_it->Next()) num_entries++; 235 for (db_it->SeekToFirst(); db_it->Valid(); db_it->Next()) num_entries++;
236 dump.append(base::IntToString(num_entries)); 236 dump.append(base::IntToString(num_entries));
237 dump.append("]"); 237 dump.append("]");
238 return dump; 238 return dump;
239 } 239 }
240 240
241 } // namespace history_report 241 } // namespace history_report
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698