1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "sql/initialization.h"
7 #include "base/no_destructor.h"
8 #include "base/synchronization/lock.h"
9 #include "base/trace_event/trace_event.h"
10 #include "third_party/sqlite/sqlite3.h"
14 void EnsureSqliteInitialized() {
15 // sqlite3_initialize() uses double-checked locking and thus can have
17 static base::NoDestructor<base::Lock> sqlite_init_lock;
18 base::AutoLock auto_lock(*sqlite_init_lock);
20 static bool first_call = true;
22 TRACE_EVENT0("sql", "EnsureSqliteInitialized");