Commit 91834bae authored by rdevlin.cronin's avatar rdevlin.cronin Committed by Commit bot

Fix "#if defined(DEBUG)" statements

A few "#if defined(DEBUG)" statements made it into chrome. Of course, there is
no DEBUG, there's only NDEBUG.  Tweak these to be "#if !defined(NDEBUG), and
make them compile.

Review URL: https://codereview.chromium.org/673063002

Cr-Commit-Position: refs/heads/master@{#301012}
parent 488b1dc9
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/common/extensions/command.h" #include "chrome/common/extensions/command.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/crx_file/id_util.h"
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
#include "extensions/browser/runtime_data.h" #include "extensions/browser/runtime_data.h"
#include "extensions/common/feature_switch.h" #include "extensions/common/feature_switch.h"
...@@ -755,13 +756,8 @@ int BrowserActionsContainer::IconHeight() { ...@@ -755,13 +756,8 @@ int BrowserActionsContainer::IconHeight() {
void BrowserActionsContainer::ToolbarExtensionAdded(const Extension* extension, void BrowserActionsContainer::ToolbarExtensionAdded(const Extension* extension,
int index) { int index) {
#if defined(DEBUG) DCHECK(!GetViewForExtension(extension)) <<
for (size_t i = 0; i < browser_action_views_.size(); ++i) { "Asked to add a browser action view for an extension that already exists";
DCHECK(browser_action_views_[i]->extension() != extension) <<
"Asked to add a browser action view for an extension that already "
"exists.";
}
#endif
if (chevron_) if (chevron_)
chevron_->CloseMenu(); chevron_->CloseMenu();
...@@ -1006,19 +1002,22 @@ size_t BrowserActionsContainer::GetIconCount() const { ...@@ -1006,19 +1002,22 @@ size_t BrowserActionsContainer::GetIconCount() const {
size_t absolute_model_visible_size = model_visible_size == -1 ? size_t absolute_model_visible_size = model_visible_size == -1 ?
model_->toolbar_items().size() : model_visible_size; model_->toolbar_items().size() : model_visible_size;
#if defined(DEBUG) #if !defined(NDEBUG)
// Good time for some sanity checks: We should never try to display more // Good time for some sanity checks: We should never try to display more
// icons than we have, and we should always have a view per item in the model. // icons than we have, and we should always have a view per item in the model.
// (The only exception is if this is in initialization.) // (The only exception is if this is in initialization.)
if (initialized_) { if (initialized_) {
size_t num_extension_actions = 0u; size_t num_extension_actions = 0u;
for (const BrowserActionView* view : browser_action_views_) { for (BrowserActionView* view : browser_action_views_) {
num_extension_actions += // No component action should ever have a valid extension id, so we can
view->view_controller()->GetType() == // use this to check the extension amount.
ToolbarActionViewController::TYPE_EXTENSION_ACTION ? 1 : 0; // TODO(devlin): Fix this to just check model size when the model also
// includes component actions.
if (crx_file::id_util::IdIsValid(view->view_controller()->GetId()))
++num_extension_actions;
} }
DCHECK_LE(absolute_model_visible_size, browser_action_views_.size()); DCHECK_LE(absolute_model_visible_size, num_extension_actions);
DCHECK_EQ(model_->toolbar_items().size(), browser_action_views_.size()); DCHECK_EQ(model_->toolbar_items().size(), num_extension_actions);
} }
#endif #endif
......
...@@ -816,12 +816,12 @@ void WrenchMenu::Init(ui::MenuModel* model) { ...@@ -816,12 +816,12 @@ void WrenchMenu::Init(ui::MenuModel* model) {
// so we get the taller menu style. // so we get the taller menu style.
PopulateMenu(root_, model); PopulateMenu(root_, model);
#if defined(DEBUG) #if !defined(NDEBUG)
// Verify that the reserved command ID's for bookmarks menu are not used. // Verify that the reserved command ID's for bookmarks menu are not used.
for (int i = WrenchMenuModel:kMinBookmarkCommandId; for (int i = WrenchMenuModel::kMinBookmarkCommandId;
i <= WrenchMenuModel::kMaxBookmarkCommandId; ++i) i <= WrenchMenuModel::kMaxBookmarkCommandId; ++i)
DCHECK(command_id_to_entry_.find(i) == command_id_to_entry_.end()); DCHECK(command_id_to_entry_.find(i) == command_id_to_entry_.end());
#endif // defined(DEBUG) #endif // !defined(NDEBUG)
int32 types = views::MenuRunner::HAS_MNEMONICS; int32 types = views::MenuRunner::HAS_MNEMONICS;
if (for_drop()) { if (for_drop()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment