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

Unified Diff: content/browser/streams/stream.cc

Issue 12615004: Fix heapcheck errors (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix the comment Created 7 years, 9 months 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 | « content/browser/streams/stream.h ('k') | content/browser/streams/stream_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/streams/stream.cc
diff --git a/content/browser/streams/stream.cc b/content/browser/streams/stream.cc
index 0efec1349e4cca6b5a75ae68ecf07fa361ca67fb..e72a8872dc541270aa99a6e637cab2dbead7dbaf 100644
--- a/content/browser/streams/stream.cc
+++ b/content/browser/streams/stream.cc
@@ -29,7 +29,8 @@ Stream::Stream(StreamRegistry* registry,
data_length_(0),
registry_(registry),
read_observer_(NULL),
- write_observer_(write_observer) {
+ write_observer_(write_observer),
+ weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
CreateByteStream(base::MessageLoopProxy::current(),
base::MessageLoopProxy::current(),
kDeferSizeThreshold,
@@ -37,8 +38,10 @@ Stream::Stream(StreamRegistry* registry,
&reader_);
// Setup callback for writing.
- writer_->RegisterCallback(base::Bind(&Stream::OnSpaceAvailable, this));
- reader_->RegisterCallback(base::Bind(&Stream::OnDataAvailable, this));
+ writer_->RegisterCallback(base::Bind(&Stream::OnSpaceAvailable,
+ weak_ptr_factory_.GetWeakPtr()));
+ reader_->RegisterCallback(base::Bind(&Stream::OnDataAvailable,
+ weak_ptr_factory_.GetWeakPtr()));
registry_->RegisterStream(this);
}
« no previous file with comments | « content/browser/streams/stream.h ('k') | content/browser/streams/stream_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698