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

Unified Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 22908008: Limit the total memory usage for Stream instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: creis's comments 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
« no previous file with comments | « content/browser/fileapi/fileapi_message_filter.h ('k') | content/browser/streams/stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/fileapi/fileapi_message_filter.cc
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc
index c735b07d7b1f16c48f6dec765ca9a649cfdcafc0..66db0d781467ea7c72839c4d3b688f6f550d3499 100644
--- a/content/browser/fileapi/fileapi_message_filter.cc
+++ b/content/browser/fileapi/fileapi_message_filter.cc
@@ -632,10 +632,10 @@ void FileAPIMessageFilter::OnAppendBlobDataItemToStream(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
scoped_refptr<Stream> stream(GetStreamForURL(url));
- if (!stream.get()) {
- NOTREACHED();
+ // Stream instances may be deleted on error. Just abort if there's no Stream
+ // instance for |url| in the registry.
+ if (!stream.get())
return;
- }
// Data for stream is delivered as TYPE_BYTES item.
if (item.type() != BlobData::Item::TYPE_BYTES) {
@@ -663,10 +663,8 @@ void FileAPIMessageFilter::OnAppendSharedMemoryToStream(
}
scoped_refptr<Stream> stream(GetStreamForURL(url));
- if (!stream.get()) {
- NOTREACHED();
+ if (!stream.get())
return;
- }
stream->AddData(static_cast<char*>(shared_memory.memory()), buffer_size);
}
@@ -676,17 +674,15 @@ void FileAPIMessageFilter::OnFinishBuildingStream(const GURL& url) {
scoped_refptr<Stream> stream(GetStreamForURL(url));
if (stream.get())
stream->Finalize();
- else
- NOTREACHED();
}
void FileAPIMessageFilter::OnCloneStream(
const GURL& url, const GURL& src_url) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (!GetStreamForURL(src_url)) {
- NOTREACHED();
+ // Abort if there's no Stream instance for |src_url| (source Stream which
+ // we're going to make |url| point to) in the registry.
+ if (!GetStreamForURL(src_url))
return;
- }
stream_context_->registry()->CloneStream(url, src_url);
stream_urls_.insert(url.spec());
@@ -695,10 +691,8 @@ void FileAPIMessageFilter::OnCloneStream(
void FileAPIMessageFilter::OnRemoveStream(const GURL& url) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (!GetStreamForURL(url).get()) {
- NOTREACHED();
+ if (!GetStreamForURL(url).get())
return;
- }
stream_context_->registry()->UnregisterStream(url);
stream_urls_.erase(url.spec());
« no previous file with comments | « content/browser/fileapi/fileapi_message_filter.h ('k') | content/browser/streams/stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698