Fix StatsTable::RegisterThread so that it doesn't crash if shared memory
couldn't be allocated. Instead, it just returns 0.

Also, fix StatsTable::AddCounter so that it's not a fatal error if shared
memory couldn't be allocated. Instead, it just returns 0.

In StatsTableTest::StatsCounter, we now assert that the counter could be
created, rather than just expecting it.  Much of the remainder of the test
relies on the fact that foo.Pointer() is non-NULL, and would crash if it
were NULL.

TEST= StatsTableTest.* RenderViewTest.*
  Didn't test on Linux (still figuring out how to build on that plaform).
Instead, tested on Mac OS X by modifying StatsTablePrivate::New to return NULL,
and then ran:
  unit_tests --gtest_filter='Render*'
  base_unittests --gtest_filter='StatsTableTest.*'
Both tests tests crashed.

Then, I applied the changes in this CL, reran the tests, and verified
the crashing no longer occured.

BUG=13193
BUG=13196

Review URL: http://codereview.chromium.org/126100
Patch from Neil Rhodes <nrhodes@google.com>.

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18527 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 3da87b4b28bf2dd6758cac894cea570a0539af63
2 files changed
tree: 0ba6a1f410e8ab7822ce6515d29cb858bcdb83c9
  1. base/
  2. build/
  3. testing/