[M120 Migration][VD] Fix url crash in RequestCertificateConfirm
[platform/framework/web/chromium-efl.git] / sql / initialization.cc
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.
4
5 #include "sql/initialization.h"
6
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"
11
12 namespace sql {
13
14 void EnsureSqliteInitialized() {
15   // sqlite3_initialize() uses double-checked locking and thus can have
16   // data races.
17   static base::NoDestructor<base::Lock> sqlite_init_lock;
18   base::AutoLock auto_lock(*sqlite_init_lock);
19
20   static bool first_call = true;
21   if (first_call) {
22     TRACE_EVENT0("sql", "EnsureSqliteInitialized");
23     sqlite3_initialize();
24     first_call = false;
25   }
26 }
27
28 }  // namespace sql