cef/libcef_dll/shutdown_checker.cc
Marshall Greenblatt 17fc2b3e3b Various fixes related to the C++11/14 update (see issue #3140)
- Convert scoped_ptr to std::unique_ptr from <memory>
- Convert arraysize to base::size from include/base/cef_cxx17_backports.h
- Convert NULL to nullptr
- Include include/base/cef_callback.h instead of include/base/cef_bind.h
- Implicit conversion of CefRefPtr<T> or scoped_refptr<T> to T* is gone;
  use .get() instead

See the issue for additional details.
2021-06-18 13:42:31 -04:00

46 lines
834 B
C++

// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "libcef_dll/shutdown_checker.h"
#include <atomic>
#include "include/base/cef_logging.h"
namespace shutdown_checker {
#if DCHECK_IS_ON()
namespace {
std::atomic_bool g_cef_shutdown{false};
bool IsCefShutdown() {
return g_cef_shutdown.load();
}
void SetCefShutdown() {
g_cef_shutdown.store(true);
}
} // namespace
void AssertNotShutdown() {
DCHECK(!IsCefShutdown())
<< "Object reference incorrectly held at CefShutdown";
}
void SetIsShutdown() {
DCHECK(!IsCefShutdown());
SetCefShutdown();
}
#else // !DCHECK_IS_ON()
void AssertNotShutdown() {}
#endif // !DCHECK_IS_ON()
} // namespace shutdown_checker