Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: chrome/browser/renderer_host/async_resource_handler.cc

Issue 391009: Don't do work in the SharedIOBuffer constructor; use an Init method instead. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/shared_memory_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/async_resource_handler.cc
===================================================================
--- chrome/browser/renderer_host/async_resource_handler.cc (revision 32401)
+++ chrome/browser/renderer_host/async_resource_handler.cc (working copy)
@@ -31,12 +31,17 @@
explicit SharedIOBuffer(int buffer_size)
: net::IOBuffer(),
ok_(false),
- buffer_size_(buffer_size) {
- if (shared_memory_.Create(std::wstring(), false, false, buffer_size) &&
- shared_memory_.Map(buffer_size)) {
+ buffer_size_(buffer_size) {}
+
+ bool Init() {
+ if (shared_memory_.Create(std::wstring(), false, false, buffer_size_) &&
+ shared_memory_.Map(buffer_size_)) {
+ data_ = reinterpret_cast<char*>(shared_memory_.memory());
+ // TODO(hawk): Remove after debugging bug 16371.
+ CHECK(data_);
ok_ = true;
- data_ = reinterpret_cast<char*>(shared_memory_.memory());
}
+ return ok_;
}
base::SharedMemory* shared_memory() { return &shared_memory_; }
@@ -111,8 +116,9 @@
*buf_size = read_buffer_->buffer_size();
} else {
read_buffer_ = new SharedIOBuffer(next_buffer_size_);
- if (!read_buffer_->ok()) {
+ if (!read_buffer_->Init()) {
DLOG(ERROR) << "Couldn't allocate shared io buffer";
+ read_buffer_ = NULL;
return false;
}
// TODO(willchan): Remove after debugging bug 16371.
« no previous file with comments | « base/shared_memory_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698