-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/process_memory_dump.h"
+#include "sql/sqlite_result_code.h"
+#include "sql/sqlite_result_code_values.h"
#include "third_party/sqlite/sqlite3.h"
namespace sql {
base::trace_event::ProcessMemoryDump* pmd) {
sqlite3_int64 memory_used = 0;
sqlite3_int64 memory_high_water = 0;
- int status = sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &memory_used,
- &memory_high_water, /* resetFlag= */ 1);
- if (status != SQLITE_OK)
- return false;
+ auto sqlite_result_code = ToSqliteResultCode(sqlite3_status64(
+ SQLITE_STATUS_MEMORY_USED, &memory_used, &memory_high_water,
+ /*resetFlag=*/1));
+ DCHECK_EQ(sqlite_result_code, SqliteResultCode::kOk)
+ << "sqlite3_status64(SQLITE_STATUS_MEMORY_USED) failed";
base::trace_event::MemoryAllocatorDump* dump =
pmd->CreateAllocatorDump("sqlite");
sqlite3_int64 dummy_high_water = -1;
sqlite3_int64 malloc_count = -1;
- status = sqlite3_status64(SQLITE_STATUS_MALLOC_COUNT, &malloc_count,
- &dummy_high_water, /* resetFlag= */ 0);
- if (status == SQLITE_OK) {
- dump->AddScalar("malloc_count",
- base::trace_event::MemoryAllocatorDump::kUnitsObjects,
- malloc_count);
- }
+ sqlite_result_code = ToSqliteResultCode(sqlite3_status64(
+ SQLITE_STATUS_MALLOC_COUNT, &malloc_count, &dummy_high_water,
+ /*resetFlag=*/0));
+ DCHECK_EQ(sqlite_result_code, SqliteResultCode::kOk)
+ << "sqlite3_status64(SQLITE_STATUS_MALLOC_COUNT) failed";
+ dump->AddScalar("malloc_count",
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ malloc_count);
const char* system_allocator_name =
base::trace_event::MemoryDumpManager::GetInstance()