Use DCHECK_IS_ON() instead of !NDEBUG for debug logic (issue #1961)

This commit is contained in:
Marshall Greenblatt
2016-09-01 14:24:30 +03:00
parent ad1619dbd7
commit 5068b50b48
278 changed files with 320 additions and 525 deletions

View File

@@ -15,14 +15,14 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#ifndef NDEBUG
#if DCHECK_IS_ON()
base::AtomicRefCount CefBrowserContext::DebugObjCt = 0;
#endif
CefBrowserContext::CefBrowserContext(bool is_proxy)
: is_proxy_(is_proxy),
extension_system_(NULL) {
#ifndef NDEBUG
#if DCHECK_IS_ON()
base::AtomicRefCountInc(&DebugObjCt);
#endif
}
@@ -31,7 +31,7 @@ CefBrowserContext::~CefBrowserContext() {
// Should be cleared in Shutdown().
DCHECK(!resource_context_.get());
#ifndef NDEBUG
#if DCHECK_IS_ON()
base::AtomicRefCountDec(&DebugObjCt);
#endif
}

View File

@@ -171,7 +171,7 @@ class CefBrowserContext
return extension_system_;
}
#ifndef NDEBUG
#if DCHECK_IS_ON()
// Simple tracking of allocated objects.
static base::AtomicRefCount DebugObjCt; // NOLINT(runtime/int)
#endif

View File

@@ -347,7 +347,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
return;
}
#ifndef NDEBUG
#if DCHECK_IS_ON()
// Verify that no request for the same route is currently queued.
{
PendingNewBrowserInfoList::const_iterator it =
@@ -408,7 +408,7 @@ void CefBrowserInfoManager::DestroyAllBrowsers() {
}
}
#ifndef NDEBUG
#if DCHECK_IS_ON()
{
// Verify that all browser windows have been destroyed.
base::AutoLock lock_scope(browser_info_lock_);

View File

@@ -229,7 +229,7 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
global_browser_context_ = NULL;
#ifndef NDEBUG
#if DCHECK_IS_ON()
// No CefBrowserContext instances should exist at this point.
DCHECK_EQ(0, CefBrowserContext::DebugObjCt);
#endif
@@ -241,7 +241,7 @@ void CefBrowserMainParts::PostDestroyThreads() {
delete views::ViewsDelegate::GetInstance();
#endif
#ifndef NDEBUG
#if DCHECK_IS_ON()
// No CefURLRequestContext instances should exist at this point.
DCHECK_EQ(0, CefURLRequestContext::DebugObjCt);
#endif

View File

@@ -762,13 +762,13 @@ void CefMenuModelImpl::InsertItemAt(const Item& item, int index) {
}
void CefMenuModelImpl::ValidateItem(const Item& item) {
#ifndef NDEBUG
#if DCHECK_IS_ON()
if (item.type_ == MENUITEMTYPE_SEPARATOR) {
DCHECK_EQ(item.command_id_, kSeparatorId);
} else {
DCHECK_GE(item.command_id_, 0);
}
#endif // NDEBUG
#endif
}
void CefMenuModelImpl::OnMenuClosed() {

View File

@@ -4,18 +4,18 @@
#include "libcef/browser/net/url_request_context.h"
#ifndef NDEBUG
#if DCHECK_IS_ON()
base::AtomicRefCount CefURLRequestContext::DebugObjCt = 0;
#endif
CefURLRequestContext::CefURLRequestContext() {
#ifndef NDEBUG
#if DCHECK_IS_ON()
base::AtomicRefCountInc(&DebugObjCt);
#endif
}
CefURLRequestContext::~CefURLRequestContext() {
#ifndef NDEBUG
#if DCHECK_IS_ON()
base::AtomicRefCountDec(&DebugObjCt);
#endif
}

View File

@@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_NET_URL_REQUEST_CONTEXT_H_
#pragma once
#include "base/logging.h"
#include "net/url_request/url_request_context.h"
// Owns URLRequest instances and provides access to network-related
@@ -18,7 +19,7 @@ class CefURLRequestContext : public net::URLRequestContext {
CefURLRequestContext();
~CefURLRequestContext() override;
#ifndef NDEBUG
#if DCHECK_IS_ON()
// Simple tracking of allocated objects.
static base::AtomicRefCount DebugObjCt; // NOLINT(runtime/int)
#endif

View File

@@ -274,7 +274,7 @@ net::URLRequestJob* CefURLRequestManager::GetRequestJob(
job = GetBuiltinSchemeRequestJob(request, network_delegate, scheme);
}
#ifndef NDEBUG
#if DCHECK_IS_ON()
if (job)
DLOG(INFO) << "CefURLRequestManager hit for " << request->url().spec();
#endif