diff options
author | hawk@chromium.org <hawk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 23:08:38 +0000 |
---|---|---|
committer | hawk@chromium.org <hawk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 23:08:38 +0000 |
commit | ad8db61766da16b0be8177aa11128f4e8ec82ba0 (patch) | |
tree | a6d75a47f3be439dd2c78a6807b57bd16b7ce27c /base/shared_memory_posix.cc | |
parent | b9148774aa3ad1d550a2835d5441febc97a4770e (diff) | |
download | chromium_src-ad8db61766da16b0be8177aa11128f4e8ec82ba0.zip chromium_src-ad8db61766da16b0be8177aa11128f4e8ec82ba0.tar.gz chromium_src-ad8db61766da16b0be8177aa11128f4e8ec82ba0.tar.bz2 |
Don't do work in the SharedIOBuffer constructor; use an Init method instead. This eliminates instances of allocated-but-invalid SharedIOBuffers. Also clean up some CHECKs and TODOs associated with the bug.
The upshot is that we no longer crash in AsyncResourceHandler::OnResponseCompleted() when we can't allocate shared memory. We now crash (properly, I believe) in the renderer process if the shared memory that failed to allocate was the TransportDIB, since the renderer can't communicate with the browser without it.
BUG=16371
TEST=none
Review URL: http://codereview.chromium.org/391009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32701 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/shared_memory_posix.cc')
-rw-r--r-- | base/shared_memory_posix.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc index 6919cfc..34e7b72 100644 --- a/base/shared_memory_posix.cc +++ b/base/shared_memory_posix.cc @@ -203,10 +203,8 @@ bool SharedMemory::CreateOrOpen(const std::wstring &name, return false; const size_t current_size = stat.st_size; if (current_size != size) { - // TODO(hawk): When finished with bug 16371, revert this CHECK() to: - // if (ftruncate(fileno(fp), size) != 0) - // return false; - CHECK(!ftruncate(fileno(fp), size)); + if (ftruncate(fileno(fp), size) != 0) + return false; if (fseeko(fp, size, SEEK_SET) != 0) return false; } |