mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-03 04:52:54 +00:00
Bug 953425 - Part d: Add DOMFileRequest::Create(); r=Ms2ger
This commit is contained in:
parent
058946a78f
commit
cbf55c77bc
@ -16,6 +16,18 @@ DOMFileRequest::DOMFileRequest(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<DOMFileRequest>
|
||||
DOMFileRequest::Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
nsRefPtr<DOMFileRequest> request = new DOMFileRequest(aOwner);
|
||||
request->mLockedFile = aLockedFile;
|
||||
|
||||
return request.forget();
|
||||
}
|
||||
|
||||
/* virtual */ JSObject*
|
||||
DOMFileRequest::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
|
@ -16,13 +16,17 @@ BEGIN_FILE_NAMESPACE
|
||||
class DOMFileRequest : public FileRequest
|
||||
{
|
||||
public:
|
||||
DOMFileRequest(nsPIDOMWindow* aWindow);
|
||||
static already_AddRefed<DOMFileRequest>
|
||||
Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
nsIDOMLockedFile* GetLockedFile() const;
|
||||
IMPL_EVENT_HANDLER(progress)
|
||||
|
||||
protected:
|
||||
DOMFileRequest(nsPIDOMWindow* aWindow);
|
||||
};
|
||||
|
||||
END_FILE_NAMESPACE
|
||||
|
@ -149,8 +149,7 @@ FileHandle::GetFile(ErrorResult& aError)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<FileRequest> request =
|
||||
FileRequest::Create(GetOwner(), lockedFile, false);
|
||||
nsRefPtr<FileRequest> request = FileRequest::Create(GetOwner(), lockedFile);
|
||||
|
||||
nsRefPtr<MetadataParameters> params = new MetadataParameters(true, false);
|
||||
|
||||
|
@ -30,18 +30,11 @@ FileRequest::~FileRequest()
|
||||
|
||||
// static
|
||||
already_AddRefed<FileRequest>
|
||||
FileRequest::Create(nsPIDOMWindow* aOwner,
|
||||
LockedFile* aLockedFile,
|
||||
bool aIsFileRequest)
|
||||
FileRequest::Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
nsRefPtr<FileRequest> request;
|
||||
if (aIsFileRequest) {
|
||||
request = new DOMFileRequest(aOwner);
|
||||
} else {
|
||||
request = new FileRequest(aOwner);
|
||||
}
|
||||
nsRefPtr<FileRequest> request = new FileRequest(aOwner);
|
||||
request->mLockedFile = aLockedFile;
|
||||
|
||||
return request.forget();
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileRequest, DOMRequest)
|
||||
|
||||
static already_AddRefed<FileRequest>
|
||||
Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile, bool aIsFileRequest);
|
||||
Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile);
|
||||
|
||||
// nsIDOMEventTarget
|
||||
virtual nsresult
|
||||
|
@ -22,9 +22,9 @@
|
||||
#include "xpcpublic.h"
|
||||
|
||||
#include "AsyncHelper.h"
|
||||
#include "DOMFileRequest.h"
|
||||
#include "FileHandle.h"
|
||||
#include "FileHelper.h"
|
||||
#include "FileRequest.h"
|
||||
#include "FileService.h"
|
||||
#include "FileStreamWrappers.h"
|
||||
#include "MemoryStreams.h"
|
||||
@ -424,7 +424,7 @@ already_AddRefed<DOMFileRequest>
|
||||
LockedFile::GenerateFileRequest()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
return FileRequest::Create(GetOwner(), this, true).downcast<DOMFileRequest>();
|
||||
return DOMFileRequest::Create(GetOwner(), this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user