Adds some debugging code in hopes of tracking down a

crash. Specifically:

. Adds a CHECK to IDMap that evaluates to true if adding NULL. The
  default isn't to do this check.
. browser_shutdown CHECKs if the # RPHs changes while iterating
  through the RPHs.

BUG=15615
TEST=none

Review URL: http://codereview.chromium.org/150181

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19779 0039d316-1c4b-4281-b951-d872f2087c98
Esse commit está contido em:
sky@chromium.org
2009-07-01 22:35:26 +00:00
commit 405d3af6f4
3 arquivos alterados com 19 adições e 3 exclusões
+14 -3
Ver Arquivo
@@ -28,12 +28,17 @@ class IDMap {
// Note, use iterator->first to get the ID, iterator->second to get the T*
typedef typename HashTable::const_iterator const_iterator;
IDMap() : next_id_(1) {
IDMap() : next_id_(1), check_on_null_data_(false) {
}
IDMap(const IDMap& other) : next_id_(other.next_id_),
data_(other.data_) {
IDMap(const IDMap& other)
: next_id_(other.next_id_),
data_(other.data_),
check_on_null_data_(other.check_on_null_data_) {
}
// Sets whether Add should CHECK if passed in NULL data. Default is false.
void set_check_on_null_data(bool value) { check_on_null_data_ = value; }
const_iterator begin() const {
return data_.begin();
}
@@ -43,6 +48,7 @@ class IDMap {
// Adds a view with an automatically generated unique ID. See AddWithID.
int32 Add(T* data) {
CHECK(!check_on_null_data_ || data);
int32 this_id = next_id_;
DCHECK(data_.find(this_id) == data_.end()) << "Inserting duplicate item";
data_[this_id] = data;
@@ -55,6 +61,7 @@ class IDMap {
// this function, or allow this object to generate IDs and call Add. These
// two methods may not be mixed, or duplicate IDs may be generated
void AddWithID(T* data, int32 id) {
CHECK(!check_on_null_data_ || data);
DCHECK(data_.find(id) == data_.end()) << "Inserting duplicate item";
data_[id] = data;
}
@@ -88,6 +95,10 @@ class IDMap {
int32 next_id_;
HashTable data_;
private:
// See description above setter.
bool check_on_null_data_;
};
#endif // BASE_ID_MAP_H__
+4
Ver Arquivo
@@ -65,6 +65,7 @@ void OnShutdownStarting(ShutdownType type) {
// a no-op in some cases, so we still need to go through the normal
// shutdown path for the ones that didn't exit here.
shutdown_num_processes_slow_ = 0;
size_t start_rph_size = RenderProcessHost::size();
for (RenderProcessHost::iterator hosts = RenderProcessHost::begin();
hosts != RenderProcessHost::end();
++hosts) {
@@ -74,6 +75,9 @@ void OnShutdownStarting(ShutdownType type) {
// higher up, it's not possible to get here. Confirm this and change
// FastShutdownIfPossible to just be FastShutdown.
shutdown_num_processes_slow_++;
// The number of RPHs should not have changed as the result of invoking
// FastShutdownIfPossible.
CHECK(start_rph_size == RenderProcessHost::size());
}
}
}
@@ -85,6 +85,7 @@ RenderProcessHost::RenderProcessHost(Profile* profile)
pid_(-1),
profile_(profile),
sudden_termination_allowed_(true) {
all_hosts.set_check_on_null_data(true);
}
RenderProcessHost::~RenderProcessHost() {