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

Side by Side Diff: extensions/browser/value_store/leveldb_value_store.cc

Issue 2973863002: Remove std::string histogram name from HistogramBase object.
Patch Set: rebased Created 3 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/value_store/leveldb_value_store.h" 5 #include "extensions/browser/value_store/leveldb_value_store.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 return true; 247 return true;
248 248
249 std::string value; 249 std::string value;
250 uint64_t size; 250 uint64_t size;
251 bool res = db()->GetProperty("leveldb.approximate-memory-usage", &value); 251 bool res = db()->GetProperty("leveldb.approximate-memory-usage", &value);
252 DCHECK(res); 252 DCHECK(res);
253 res = base::StringToUint64(value, &size); 253 res = base::StringToUint64(value, &size);
254 DCHECK(res); 254 DCHECK(res);
255 255
256 auto* dump = pmd->CreateAllocatorDump(base::StringPrintf( 256 auto* dump = pmd->CreateAllocatorDump(base::StringPrintf(
257 "leveldb/value_store/%s/0x%" PRIXPTR, open_histogram_name().c_str(), 257 "leveldb/value_store/%s/0x%" PRIXPTR, open_histogram_name(),
258 reinterpret_cast<uintptr_t>(this))); 258 reinterpret_cast<uintptr_t>(this)));
259 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 259 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
260 base::trace_event::MemoryAllocatorDump::kUnitsBytes, size); 260 base::trace_event::MemoryAllocatorDump::kUnitsBytes, size);
261 261
262 // All leveldb databases are already dumped by leveldb_env::DBTracker. Add 262 // All leveldb databases are already dumped by leveldb_env::DBTracker. Add
263 // an edge to avoid double counting. 263 // an edge to avoid double counting.
264 pmd->AddSuballocation(dump->guid(), 264 pmd->AddSuballocation(dump->guid(),
265 leveldb_env::DBTracker::GetMemoryDumpName(db())); 265 leveldb_env::DBTracker::GetMemoryDumpName(db()));
266 266
267 return true; 267 return true;
(...skipping 26 matching lines...) Expand all
294 return Status(OTHER_ERROR, kCannotSerialize); 294 return Status(OTHER_ERROR, kCannotSerialize);
295 batch->Put(key, value_as_json); 295 batch->Put(key, value_as_json);
296 } 296 }
297 297
298 return Status(); 298 return Status();
299 } 299 }
300 300
301 ValueStore::Status LeveldbValueStore::WriteToDb(leveldb::WriteBatch* batch) { 301 ValueStore::Status LeveldbValueStore::WriteToDb(leveldb::WriteBatch* batch) {
302 return ToValueStoreError(db()->Write(write_options(), batch)); 302 return ToValueStoreError(db()->Write(write_options(), batch));
303 } 303 }
OLDNEW
« no previous file with comments | « extensions/browser/value_store/lazy_leveldb.h ('k') | third_party/webrtc_overrides/init_webrtc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698