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

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

Issue 22908008: Limit the total memory usage for Stream instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
Index: content/browser/streams/stream.h
diff --git a/content/browser/streams/stream.h b/content/browser/streams/stream.h
index 85edc8840817c3a7d8fde67a1ed0a36eb9caa587..d4b800e8ae818ac57681d9c46aa76e35161fa4fa 100644
--- a/content/browser/streams/stream.h
+++ b/content/browser/streams/stream.h
@@ -81,6 +81,11 @@ class CONTENT_EXPORT Stream : public base::RefCountedThreadSafe<Stream> {
const GURL& url() const { return url_; }
+ // For StreamRegistry to remember the last memory usage reported to it.
+ size_t last_total_buffered_bytes() const {
+ return last_total_buffered_bytes_;
+ }
+
private:
friend class base::RefCountedThreadSafe<Stream>;
@@ -97,6 +102,10 @@ class CONTENT_EXPORT Stream : public base::RefCountedThreadSafe<Stream> {
scoped_refptr<net::IOBuffer> data_;
size_t data_length_;
+ // Last value returned by writer_->TotalBufferedBytes() in AddData(). Stored
+ // in order to check memory usage.
+ size_t last_total_buffered_bytes_;
+
scoped_ptr<ByteStreamWriter> writer_;
scoped_ptr<ByteStreamReader> reader_;

Powered by Google App Engine
This is Rietveld 408576698