summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 16:10:28 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 16:10:28 +0000
commit48f65dde6736a55e4ab588491fcc0ec1987d7f29 (patch)
tree00be2a51151ac379dcb93e5ac5407d9cf3d030ee
parent3528285f8451893839ce1084111e533f74546a53 (diff)
downloadchromium_src-48f65dde6736a55e4ab588491fcc0ec1987d7f29.zip
chromium_src-48f65dde6736a55e4ab588491fcc0ec1987d7f29.tar.gz
chromium_src-48f65dde6736a55e4ab588491fcc0ec1987d7f29.tar.bz2
Removes debugging code that proved unnecessary.
BUG=none TEST=none Review URL: http://codereview.chromium.org/552005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36355 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/state_tracker.cc35
-rw-r--r--chrome/browser/state_tracker.h40
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc22
-rw-r--r--chrome/browser/tabs/tab_strip_model.h24
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc14
-rwxr-xr-xchrome/chrome_browser.gypi2
6 files changed, 2 insertions, 135 deletions
diff --git a/chrome/browser/state_tracker.cc b/chrome/browser/state_tracker.cc
deleted file mode 100644
index 03af631..0000000
--- a/chrome/browser/state_tracker.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2009 The Chromium 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 "chrome/browser/state_tracker.h"
-
-// Number of characters the buffer contains.
-static const size_t kSize = 256;
-
-StateTracker::StateTracker()
- : index_(0),
- content_(new char[kSize]) {
- for (size_t i = 0; i < kSize; ++i)
- content_[i] = '\0';
-}
-
-void StateTracker::Append(const std::string& text) {
- if (text.size() >= kSize) {
- NOTREACHED();
- return;
- }
- for (size_t i = 0; i < text.size(); ++i) {
- content_[index_] = text[i];
- index_ = (index_ + 1) % kSize;
- }
- content_[index_] = '!';
-}
-
-void StateTracker::Crash() {
- volatile char state[kSize];
- for (size_t i = 0; i < kSize; ++i)
- state[i] = content_[i];
-
- CHECK(false);
-}
diff --git a/chrome/browser/state_tracker.h b/chrome/browser/state_tracker.h
deleted file mode 100644
index 3d9ce2e..0000000
--- a/chrome/browser/state_tracker.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_STATE_TRACKER_H_
-#define CHROME_BROWSER_STATE_TRACKER_H_
-
-#include <string>
-
-#include "base/logging.h"
-#include "base/scoped_ptr.h"
-
-// StateTracker maintains a circular character buffer. It is intended for use in
-// tracking down crashes. As various events occur invoke Append. When you're
-// ready to crash, invoke Crash, which copies the state onto
-// the state and CHECKs.
-// The '!' in the array indicates the position the next character is inserted.
-// The string of characters before the '!' gives the most recent strings that
-// were appended.
-class StateTracker {
- public:
- StateTracker();
-
- // Appends |text|.
- void Append(const std::string& text);
-
- // Copies the appended text onto the stack and CHECKs.
- void Crash();
-
- private:
- // Current index into the string content is inserted at.
- size_t index_;
-
- // The content.
- scoped_array<char> content_;
-
- DISALLOW_COPY_AND_ASSIGN(StateTracker);
-};
-
-#endif // CHROME_BROWSER_STATE_TRACKER_H_
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index d143c55..783e27c 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -59,7 +59,6 @@ TabStripModel::TabStripModel(TabStripModelDelegate* delegate, Profile* profile)
}
TabStripModel::~TabStripModel() {
- LogEvent(DELETE_MODEL);
STLDeleteContainerPointers(contents_data_.begin(), contents_data_.end());
delete order_controller_;
}
@@ -94,7 +93,6 @@ void TabStripModel::InsertTabContentsAt(int index,
TabContents* contents,
bool foreground,
bool inherit_group) {
- LogEvent(INSERT);
// In tab dragging situations, if the last tab in the window was detached
// then the user aborted the drag, we will have the |closing_all_| member
// set (see DetachTabContentsAt) which will mess with our mojo here. We need
@@ -134,7 +132,6 @@ void TabStripModel::InsertTabContentsAt(int index,
void TabStripModel::ReplaceNavigationControllerAt(
int index, NavigationController* controller) {
- LogEvent(REPLACE);
// This appears to be OK with no flicker since no redraw event
// occurs between the call to add an aditional tab and one to close
// the previous tab.
@@ -149,15 +146,12 @@ TabContents* TabStripModel::DetachTabContentsAt(int index) {
return NULL;
DCHECK(ContainsIndex(index));
- LogEvent(DETACH);
TabContents* removed_contents = GetContentsAt(index);
next_selected_index_ = order_controller_->DetermineNewSelectedIndex(index);
delete contents_data_.at(index);
contents_data_.erase(contents_data_.begin() + index);
- if (contents_data_.empty()) {
- LogEvent(DETACH_EMPTY);
+ if (contents_data_.empty())
closing_all_ = true;
- }
TabStripModelObservers::Iterator iter(observers_);
while (TabStripModelObserver* obs = iter.GetNext()) {
obs->TabDetachedAt(removed_contents, index);
@@ -185,7 +179,6 @@ void TabStripModel::SelectTabContentsAt(int index, bool user_gesture) {
void TabStripModel::MoveTabContentsAt(int index, int to_position,
bool select_after_move) {
- LogEvent(MOVE);
MoveTabContentsAtImpl(index, to_position, select_after_move, true);
}
@@ -229,7 +222,6 @@ void TabStripModel::UpdateTabContentsStateAt(int index,
}
void TabStripModel::CloseAllTabs() {
- LogEvent(CLOSE_ALL);
// Set state so that observers can adjust their behavior to suit this
// specific condition when CloseTabContentsAt causes a flurry of
// Close/Detach/Select notifications to be sent.
@@ -355,8 +347,6 @@ void TabStripModel::SetTabPinned(int index, bool pinned) {
if (contents_data_[index]->pinned == pinned)
return;
- LogEvent(PIN);
-
int first_non_pinned_tab = IndexOfFirstNonPinnedTab();
contents_data_[index]->pinned = pinned;
@@ -490,7 +480,6 @@ void TabStripModel::MoveTabPrevious() {
Browser* TabStripModel::TearOffTabContents(TabContents* detached_contents,
const gfx::Rect& window_bounds,
const DockInfo& dock_info) {
- LogEvent(TEAR);
DCHECK(detached_contents);
return delegate_->CreateNewStripWithContents(detached_contents, window_bounds,
dock_info);
@@ -626,7 +615,6 @@ void TabStripModel::Observe(NotificationType type,
// here so we don't crash later.
int index = GetIndexOfTabContents(Source<TabContents>(source).ptr());
if (index != TabStripModel::kNoTab) {
- LogEvent(TAB_DESTROYED);
// Note that we only detach the contents here, not close it - it's already
// been closed. We just want to undo our bookkeeping.
DetachTabContentsAt(index);
@@ -645,8 +633,6 @@ bool TabStripModel::IsNewTabAtEndOfTabStrip(TabContents* contents) const {
bool TabStripModel::InternalCloseTabs(std::vector<int> indices,
bool create_historical_tabs) {
- LogEvent(CLOSE);
-
bool retval = true;
// We only try the fast shutdown path if the whole browser process is *not*
@@ -782,9 +768,3 @@ bool TabStripModel::OpenerMatches(const TabContentsData* data,
bool use_group) {
return data->opener == opener || (use_group && data->group == opener);
}
-
-void TabStripModel::LogEvent(Event type) {
- char c = 'a' + (int)type;
- tracker_.Append(std::string(&c, 1));
- tracker_.Append(IntToString(count()));
-}
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index 19ea875..fe94524 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -8,7 +8,6 @@
#include <vector>
#include "base/observer_list.h"
-#include "chrome/browser/state_tracker.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/page_transition_types.h"
@@ -283,9 +282,6 @@ class TabStripModel : public NotificationObserver {
return order_controller_;
}
- // Returns the StateTracker. This never returns null.
- StateTracker* tracker() { return &tracker_; }
-
// Returns true if |observer| is in the list of observers. This is intended
// for debugging.
bool HasObserver(TabStripModelObserver* observer);
@@ -553,24 +549,6 @@ class TabStripModel : public NotificationObserver {
// be |opener|'s NavigationController.
void SetOpenerForContents(TabContents* contents, TabContents* opener);
- // In hopes of tracking a crash we're logging various events. These events
- // are logged to tracker_ with the following characters.
- enum Event {
- INSERT = 0, // a
- REPLACE, // b
- DETACH, // c
- DETACH_EMPTY, // d
- MOVE, // e
- CLOSE_ALL, // f
- TEAR, // g
- DELETE_MODEL, // h
- CLOSE, // i
- PIN, // j
- TAB_DESTROYED // k
- };
-
- void LogEvent(Event type);
-
// Returns true if the tab represented by the specified data has an opener
// that matches the specified one. If |use_group| is true, then this will
// fall back to check the group relationship as well.
@@ -668,8 +646,6 @@ class TabStripModel : public NotificationObserver {
// A scoped container for notification registries.
NotificationRegistrar registrar_;
- StateTracker tracker_;
-
DISALLOW_COPY_AND_ASSIGN(TabStripModel);
};
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index ff9df02..e8838a7 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -1294,19 +1294,7 @@ void TabStrip::MaybeStartDrag(Tab* tab, const views::MouseEvent& event) {
return;
int index = GetIndexOfTab(tab);
if (!model_->ContainsIndex(index)) {
- // It appears to be possible for a drag to start with an invalid tab.
- // This records some extra information in hopes of tracking down why.
- std::string tmp;
- StateTracker* tracker = model_->tracker();
- tracker->Append("|");
- if (model_->closing_all())
- tracker->Append("A");
- tracker->Append(" " + IntToString(index));
- tracker->Append(" " + IntToString(GetTabCount()));
- tracker->Append(" " + IntToString(model_->count()));
- if (model_->HasObserver(this))
- tracker->Append("Y");
- tracker->Crash();
+ CHECK(false);
return;
}
drag_controller_.reset(new DraggedTabController(tab, this));
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 8275553..c4769b6 100755
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1547,8 +1547,6 @@
'browser/sync/sync_ui_util.h',
'browser/sync/sync_ui_util_mac.mm',
'browser/sync/sync_ui_util_mac.h',
- 'browser/state_tracker.cc',
- 'browser/state_tracker.h',
'browser/tab_contents/constrained_window.h',
'browser/tab_contents/infobar_delegate.cc',
'browser/tab_contents/infobar_delegate.h',