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

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

Issue 1549643002: Switch to standard integer types in extensions/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean
Patch Set: Created 4 years, 12 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 <stdint.h>
8
7 #include <utility> 9 #include <utility>
8 10
9 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
10 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
11 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
12 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h"
13 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
16 #include "base/strings/sys_string_conversions.h" 19 #include "base/strings/sys_string_conversions.h"
17 #include "base/thread_task_runner_handle.h" 20 #include "base/thread_task_runner_handle.h"
18 #include "base/trace_event/memory_dump_manager.h" 21 #include "base/trace_event/memory_dump_manager.h"
19 #include "base/trace_event/process_memory_dump.h" 22 #include "base/trace_event/process_memory_dump.h"
20 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
21 #include "third_party/leveldatabase/env_chromium.h" 24 #include "third_party/leveldatabase/env_chromium.h"
22 #include "third_party/leveldatabase/src/include/leveldb/iterator.h" 25 #include "third_party/leveldatabase/src/include/leveldb/iterator.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 bool LeveldbValueStore::OnMemoryDump( 325 bool LeveldbValueStore::OnMemoryDump(
323 const base::trace_event::MemoryDumpArgs& args, 326 const base::trace_event::MemoryDumpArgs& args,
324 base::trace_event::ProcessMemoryDump* pmd) { 327 base::trace_event::ProcessMemoryDump* pmd) {
325 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 328 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
326 329
327 // Return true so that the provider is not disabled. 330 // Return true so that the provider is not disabled.
328 if (!db_) 331 if (!db_)
329 return true; 332 return true;
330 333
331 std::string value; 334 std::string value;
332 uint64 size; 335 uint64_t size;
333 bool res = db_->GetProperty("leveldb.approximate-memory-usage", &value); 336 bool res = db_->GetProperty("leveldb.approximate-memory-usage", &value);
334 DCHECK(res); 337 DCHECK(res);
335 res = base::StringToUint64(value, &size); 338 res = base::StringToUint64(value, &size);
336 DCHECK(res); 339 DCHECK(res);
337 340
338 auto dump = pmd->CreateAllocatorDump( 341 auto dump = pmd->CreateAllocatorDump(
339 base::StringPrintf("leveldb/value_store/%s/%p", 342 base::StringPrintf("leveldb/value_store/%s/%p",
340 open_histogram_->histogram_name().c_str(), this)); 343 open_histogram_->histogram_name().c_str(), this));
341 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 344 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
342 base::trace_event::MemoryAllocatorDump::kUnitsBytes, size); 345 base::trace_event::MemoryAllocatorDump::kUnitsBytes, size);
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 CHECK(!status.IsNotFound()); // not an error 570 CHECK(!status.IsNotFound()); // not an error
568 571
569 std::string message = status.ToString(); 572 std::string message = status.ToString();
570 // The message may contain |db_path_|, which may be considered sensitive 573 // The message may contain |db_path_|, which may be considered sensitive
571 // data, and those strings are passed to the extension, so strip it out. 574 // data, and those strings are passed to the extension, so strip it out.
572 base::ReplaceSubstringsAfterOffset( 575 base::ReplaceSubstringsAfterOffset(
573 &message, 0u, db_path_.AsUTF8Unsafe(), "..."); 576 &message, 0u, db_path_.AsUTF8Unsafe(), "...");
574 577
575 return Status(LevelDbToValueStoreStatus(status), message); 578 return Status(LevelDbToValueStoreStatus(status), message);
576 } 579 }
OLDNEW
« no previous file with comments | « extensions/browser/value_store/leveldb_value_store.h ('k') | extensions/browser/value_store/leveldb_value_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698