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

Side by Side Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 23543002: Add an IPC to abort Stream construction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/fileapi/fileapi_message_filter.h" 5 #include "content/browser/fileapi/fileapi_message_filter.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 OnAppendSharedMemoryToBlob) 188 OnAppendSharedMemoryToBlob)
189 IPC_MESSAGE_HANDLER(BlobHostMsg_FinishBuilding, OnFinishBuildingBlob) 189 IPC_MESSAGE_HANDLER(BlobHostMsg_FinishBuilding, OnFinishBuildingBlob)
190 IPC_MESSAGE_HANDLER(BlobHostMsg_Clone, OnCloneBlob) 190 IPC_MESSAGE_HANDLER(BlobHostMsg_Clone, OnCloneBlob)
191 IPC_MESSAGE_HANDLER(BlobHostMsg_Remove, OnRemoveBlob) 191 IPC_MESSAGE_HANDLER(BlobHostMsg_Remove, OnRemoveBlob)
192 IPC_MESSAGE_HANDLER(StreamHostMsg_StartBuilding, OnStartBuildingStream) 192 IPC_MESSAGE_HANDLER(StreamHostMsg_StartBuilding, OnStartBuildingStream)
193 IPC_MESSAGE_HANDLER(StreamHostMsg_AppendBlobDataItem, 193 IPC_MESSAGE_HANDLER(StreamHostMsg_AppendBlobDataItem,
194 OnAppendBlobDataItemToStream) 194 OnAppendBlobDataItemToStream)
195 IPC_MESSAGE_HANDLER(StreamHostMsg_SyncAppendSharedMemory, 195 IPC_MESSAGE_HANDLER(StreamHostMsg_SyncAppendSharedMemory,
196 OnAppendSharedMemoryToStream) 196 OnAppendSharedMemoryToStream)
197 IPC_MESSAGE_HANDLER(StreamHostMsg_FinishBuilding, OnFinishBuildingStream) 197 IPC_MESSAGE_HANDLER(StreamHostMsg_FinishBuilding, OnFinishBuildingStream)
198 IPC_MESSAGE_HANDLER(StreamHostMsg_AbortBuilding, OnAbortBuildingStream)
198 IPC_MESSAGE_HANDLER(StreamHostMsg_Clone, OnCloneStream) 199 IPC_MESSAGE_HANDLER(StreamHostMsg_Clone, OnCloneStream)
199 IPC_MESSAGE_HANDLER(StreamHostMsg_Remove, OnRemoveStream) 200 IPC_MESSAGE_HANDLER(StreamHostMsg_Remove, OnRemoveStream)
200 IPC_MESSAGE_UNHANDLED(handled = false) 201 IPC_MESSAGE_UNHANDLED(handled = false)
201 IPC_END_MESSAGE_MAP_EX() 202 IPC_END_MESSAGE_MAP_EX()
202 return handled; 203 return handled;
203 } 204 }
204 205
205 FileAPIMessageFilter::~FileAPIMessageFilter() {} 206 FileAPIMessageFilter::~FileAPIMessageFilter() {}
206 207
207 void FileAPIMessageFilter::BadMessageReceived() { 208 void FileAPIMessageFilter::BadMessageReceived() {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 stream->AddData(static_cast<char*>(shared_memory.memory()), buffer_size); 670 stream->AddData(static_cast<char*>(shared_memory.memory()), buffer_size);
670 } 671 }
671 672
672 void FileAPIMessageFilter::OnFinishBuildingStream(const GURL& url) { 673 void FileAPIMessageFilter::OnFinishBuildingStream(const GURL& url) {
673 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 674 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
674 scoped_refptr<Stream> stream(GetStreamForURL(url)); 675 scoped_refptr<Stream> stream(GetStreamForURL(url));
675 if (stream.get()) 676 if (stream.get())
676 stream->Finalize(); 677 stream->Finalize();
677 } 678 }
678 679
680 void FileAPIMessageFilter::OnAbortBuildingStream(const GURL& url) {
681 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
682 scoped_refptr<Stream> stream(GetStreamForURL(url));
683 if (stream.get())
684 stream->Abort();
685 }
686
679 void FileAPIMessageFilter::OnCloneStream( 687 void FileAPIMessageFilter::OnCloneStream(
680 const GURL& url, const GURL& src_url) { 688 const GURL& url, const GURL& src_url) {
681 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 689 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
682 // Abort if there's no Stream instance for |src_url| (source Stream which 690 // Abort if there's no Stream instance for |src_url| (source Stream which
683 // we're going to make |url| point to) in the registry. 691 // we're going to make |url| point to) in the registry.
684 if (!GetStreamForURL(src_url)) 692 if (!GetStreamForURL(src_url))
685 return; 693 return;
686 694
687 stream_context_->registry()->CloneStream(url, src_url); 695 stream_context_->registry()->CloneStream(url, src_url);
688 stream_urls_.insert(url.spec()); 696 stream_urls_.insert(url.spec());
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 const FileSystemURL& url, int permissions, base::PlatformFileError* error) { 857 const FileSystemURL& url, int permissions, base::PlatformFileError* error) {
850 return CheckFileSystemPermissionsForProcess(context_, process_id_, url, 858 return CheckFileSystemPermissionsForProcess(context_, process_id_, url,
851 permissions, error); 859 permissions, error);
852 } 860 }
853 861
854 scoped_refptr<Stream> FileAPIMessageFilter::GetStreamForURL(const GURL& url) { 862 scoped_refptr<Stream> FileAPIMessageFilter::GetStreamForURL(const GURL& url) {
855 return stream_context_->registry()->GetStream(url); 863 return stream_context_->registry()->GetStream(url);
856 } 864 }
857 865
858 } // namespace content 866 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698