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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/streams/stream.h" 5 #include "content/browser/streams/stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "content/browser/streams/stream_read_observer.h" 9 #include "content/browser/streams/stream_read_observer.h"
10 #include "content/browser/streams/stream_registry.h" 10 #include "content/browser/streams/stream_registry.h"
(...skipping 11 matching lines...) Expand all
22 StreamWriteObserver* write_observer, 22 StreamWriteObserver* write_observer,
23 const GURL& security_origin, 23 const GURL& security_origin,
24 const GURL& url) 24 const GURL& url)
25 : bytes_read_(0), 25 : bytes_read_(0),
26 can_add_data_(true), 26 can_add_data_(true),
27 security_origin_(security_origin), 27 security_origin_(security_origin),
28 url_(url), 28 url_(url),
29 data_length_(0), 29 data_length_(0),
30 registry_(registry), 30 registry_(registry),
31 read_observer_(NULL), 31 read_observer_(NULL),
32 write_observer_(write_observer) { 32 write_observer_(write_observer),
33 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
33 CreateByteStream(base::MessageLoopProxy::current(), 34 CreateByteStream(base::MessageLoopProxy::current(),
34 base::MessageLoopProxy::current(), 35 base::MessageLoopProxy::current(),
35 kDeferSizeThreshold, 36 kDeferSizeThreshold,
36 &writer_, 37 &writer_,
37 &reader_); 38 &reader_);
38 39
39 // Setup callback for writing. 40 // Setup callback for writing.
40 writer_->RegisterCallback(base::Bind(&Stream::OnSpaceAvailable, this)); 41 writer_->RegisterCallback(base::Bind(&Stream::OnSpaceAvailable,
41 reader_->RegisterCallback(base::Bind(&Stream::OnDataAvailable, this)); 42 weak_ptr_factory_.GetWeakPtr()));
43 reader_->RegisterCallback(base::Bind(&Stream::OnDataAvailable,
44 weak_ptr_factory_.GetWeakPtr()));
42 45
43 registry_->RegisterStream(this); 46 registry_->RegisterStream(this);
44 } 47 }
45 48
46 Stream::~Stream() { 49 Stream::~Stream() {
47 } 50 }
48 51
49 bool Stream::SetReadObserver(StreamReadObserver* observer) { 52 bool Stream::SetReadObserver(StreamReadObserver* observer) {
50 if (read_observer_) 53 if (read_observer_)
51 return false; 54 return false;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 can_add_data_ = true; 107 can_add_data_ = true;
105 write_observer_->OnSpaceAvailable(this); 108 write_observer_->OnSpaceAvailable(this);
106 } 109 }
107 110
108 void Stream::OnDataAvailable() { 111 void Stream::OnDataAvailable() {
109 read_observer_->OnDataAvailable(this); 112 read_observer_->OnDataAvailable(this);
110 } 113 }
111 114
112 } // namespace content 115 } // namespace content
113 116
OLDNEW
« 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