mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
93f97225b6
- Bug 1161913 - Part 2. Request canvas to push out its next drawn frame instead of pulling it. r=mt (b2ddcd68c3) - Bug 1161913 - Part 3 - Relax requestFrame ordering guarantee in tests. r=mt (8bc69b9fc4) - Bug 1176945 - Remove unnecessary hwc reference from gl r=jgilbert (8f1ac06d99) - spaces and restore XP specific (ac03acf252) - reinstantiate some gfx log (d7deb9c3bd) - Bug 1191042 - Use CreateOffscreen for WebGL instead of CreateHeadless. - r=jrmuizel (f98fd02e59) - space (ad72b4f071) - Bug 1183085 - Remove EndConstruction() from layer documentation; r=roc (b1ef791fea) - Bug 771288 - Multiprocess FileHandle support (FileHandle on PBackground); r=baku (f77ab5b9c3) - Bug 1202788 - Upgrade object_data table to new format (follow-up to bug 871846). r=janv (ea86fd2890) - Bug 1204183 - Test the object_data upgrade from bug 1202788. r=janv (5a48cfdf17) - Bug 1198814 - Use StructuredCloneHelper in PromiseWorkerProxy, r=smaug (10e9f33700) - namespace name (b4feaf8e67) - Bug 1203561 - Use StructuredCloneHelper in StackScopedCloneData, r=smaug (156525cf32) - Bug 1209919 - Improving naming and comments in StructuredCloneHelper, r=smaug (f177bca203) - Bug 1167100 - User originAttribute in ContentPrincipalInfo. r=bholley (340c3d606e) - Bug 1182197 investigation patch. Log the stack at promise fulfillment on a CCed promise into the crash reporter data. r=dmajor,nsm (376c1bba93) - Bug 1183907, properly wrappercache worker URL object, r=baku (d71937b9d0) - Bug 1203463 - URL constructor should support about:blank URI, r=bz (d539b63667) - Bug 1207496 - Part 4: Remove use of expression closure from services/sync/. r=gps (f1eae787d9) - Bug 1207496 - Part 3: Remove use of expression closure from services/fxaccounts/. r=markh (f60e64c061) - Bug 1207496 - Part 2: Remove use of expression closure from services/crypt/. r=mrbkap (ec2738f497) - Bug 1207496 - Part 1: Remove use of expression closure from services/common/. r=gps (3464407503) - Bug 1134881 - Sync password timeCreated & timePasswordChanged fields. r=rnewman (96befc78b2) - adapted version of Bug 753289 - Pre: rename WEAVE_SYNC_PREFS to PREF_SYNC_PREFS_PREFIX. (5987671e36)
247 lines
4.8 KiB
C++
247 lines
4.8 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_dom_FileHandle_h
|
|
#define mozilla_dom_FileHandle_h
|
|
|
|
#include "FileHandleCommon.h"
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
|
#include "mozilla/dom/FileModeBinding.h"
|
|
#include "mozilla/dom/Nullable.h"
|
|
#include "mozilla/dom/TypedArray.h"
|
|
|
|
template <class> struct already_AddRefed;
|
|
class nsAString;
|
|
struct PRThread;
|
|
|
|
namespace mozilla {
|
|
|
|
class ErrorResult;
|
|
|
|
namespace dom {
|
|
|
|
class BackgroundFileHandleChild;
|
|
class Blob;
|
|
class FileRequestBase;
|
|
class FileRequestData;
|
|
class FileRequestParams;
|
|
class MutableFileBase;
|
|
class StringOrArrayBufferOrArrayBufferViewOrBlob;
|
|
|
|
/**
|
|
* This class provides a base for FileHandle implementations.
|
|
*/
|
|
class FileHandleBase
|
|
: public RefCountedThreadObject
|
|
{
|
|
public:
|
|
enum ReadyState
|
|
{
|
|
INITIAL = 0,
|
|
LOADING,
|
|
FINISHING,
|
|
DONE
|
|
};
|
|
|
|
private:
|
|
BackgroundFileHandleChild* mBackgroundActor;
|
|
|
|
uint64_t mLocation;
|
|
|
|
uint32_t mPendingRequestCount;
|
|
|
|
ReadyState mReadyState;
|
|
FileMode mMode;
|
|
|
|
bool mAborted;
|
|
bool mCreating;
|
|
|
|
DEBUGONLY(bool mSentFinishOrAbort;)
|
|
DEBUGONLY(bool mFiredCompleteOrAbort;)
|
|
|
|
public:
|
|
static FileHandleBase*
|
|
GetCurrent();
|
|
|
|
void
|
|
SetBackgroundActor(BackgroundFileHandleChild* aActor);
|
|
|
|
void
|
|
ClearBackgroundActor()
|
|
{
|
|
AssertIsOnOwningThread();
|
|
|
|
mBackgroundActor = nullptr;
|
|
}
|
|
|
|
void
|
|
StartRequest(FileRequestBase* aFileRequest, const FileRequestParams& aParams);
|
|
|
|
void
|
|
OnNewRequest();
|
|
|
|
void
|
|
OnRequestFinished(bool aActorDestroyedNormally);
|
|
|
|
bool
|
|
IsOpen() const;
|
|
|
|
bool
|
|
IsFinishingOrDone() const
|
|
{
|
|
AssertIsOnOwningThread();
|
|
|
|
return mReadyState == FINISHING || mReadyState == DONE;
|
|
}
|
|
|
|
bool
|
|
IsDone() const
|
|
{
|
|
AssertIsOnOwningThread();
|
|
|
|
return mReadyState == DONE;
|
|
}
|
|
|
|
bool
|
|
IsAborted() const
|
|
{
|
|
AssertIsOnOwningThread();
|
|
return mAborted;
|
|
}
|
|
|
|
void
|
|
SetCreating()
|
|
{
|
|
mCreating = true;
|
|
}
|
|
|
|
void
|
|
Abort();
|
|
|
|
// Shared WebIDL (IndexedDB FileHandle and FileSystem FileHandle)
|
|
FileMode
|
|
Mode() const
|
|
{
|
|
AssertIsOnOwningThread();
|
|
return mMode;
|
|
}
|
|
|
|
bool
|
|
Active() const
|
|
{
|
|
AssertIsOnOwningThread();
|
|
return IsOpen();
|
|
}
|
|
|
|
Nullable<uint64_t>
|
|
GetLocation() const
|
|
{
|
|
AssertIsOnOwningThread();
|
|
|
|
if (mLocation == UINT64_MAX) {
|
|
return Nullable<uint64_t>();
|
|
}
|
|
|
|
return Nullable<uint64_t>(mLocation);
|
|
}
|
|
|
|
void
|
|
SetLocation(const Nullable<uint64_t>& aLocation)
|
|
{
|
|
AssertIsOnOwningThread();
|
|
|
|
// Null means the end-of-file.
|
|
if (aLocation.IsNull()) {
|
|
mLocation = UINT64_MAX;
|
|
} else {
|
|
mLocation = aLocation.Value();
|
|
}
|
|
}
|
|
|
|
already_AddRefed<FileRequestBase>
|
|
Read(uint64_t aSize, bool aHasEncoding, const nsAString& aEncoding,
|
|
ErrorResult& aRv);
|
|
|
|
already_AddRefed<FileRequestBase>
|
|
Truncate(const Optional<uint64_t>& aSize, ErrorResult& aRv);
|
|
|
|
already_AddRefed<FileRequestBase>
|
|
Flush(ErrorResult& aRv);
|
|
|
|
void
|
|
Abort(ErrorResult& aRv);
|
|
|
|
// Must be overridden in subclasses.
|
|
virtual MutableFileBase*
|
|
MutableFile() const = 0;
|
|
|
|
// May be overridden in subclasses.
|
|
virtual void
|
|
HandleCompleteOrAbort(bool aAborted);
|
|
|
|
protected:
|
|
FileHandleBase(DEBUGONLY(PRThread* aOwningThread,)
|
|
FileMode aMode);
|
|
|
|
~FileHandleBase();
|
|
|
|
void
|
|
OnReturnToEventLoop();
|
|
|
|
bool
|
|
CheckState(ErrorResult& aRv);
|
|
|
|
bool
|
|
CheckStateAndArgumentsForRead(uint64_t aSize, ErrorResult& aRv);
|
|
|
|
bool
|
|
CheckStateForWrite(ErrorResult& aRv);
|
|
|
|
bool
|
|
CheckStateForWriteOrAppend(bool aAppend, ErrorResult& aRv);
|
|
|
|
already_AddRefed<FileRequestBase>
|
|
WriteOrAppend(const StringOrArrayBufferOrArrayBufferViewOrBlob& aValue,
|
|
bool aAppend,
|
|
ErrorResult& aRv);
|
|
|
|
// Must be overridden in subclasses.
|
|
virtual bool
|
|
CheckWindow() = 0;
|
|
|
|
// Must be overridden in subclasses.
|
|
virtual already_AddRefed<FileRequestBase>
|
|
GenerateFileRequest() = 0;
|
|
|
|
private:
|
|
already_AddRefed<FileRequestBase>
|
|
WriteOrAppend(const nsAString& aValue, bool aAppend, ErrorResult& aRv);
|
|
|
|
already_AddRefed<FileRequestBase>
|
|
WriteOrAppend(const ArrayBuffer& aValue, bool aAppend, ErrorResult& aRv);
|
|
|
|
already_AddRefed<FileRequestBase>
|
|
WriteOrAppend(const ArrayBufferView& aValue, bool aAppend, ErrorResult& aRv);
|
|
|
|
already_AddRefed<FileRequestBase>
|
|
WriteOrAppend(Blob& aValue, bool aAppend, ErrorResult& aRv);
|
|
|
|
already_AddRefed<FileRequestBase>
|
|
WriteInternal(const FileRequestData& aData, uint64_t aDataLength,
|
|
bool aAppend, ErrorResult& aRv);
|
|
|
|
void
|
|
SendFinish();
|
|
|
|
void
|
|
SendAbort();
|
|
};
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_dom_FileHandle_h
|