michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_workers_filereadersync_h__ michael@0: #define mozilla_dom_workers_filereadersync_h__ michael@0: michael@0: #include "Workers.h" michael@0: michael@0: class nsIInputStream; michael@0: class nsIDOMBlob; michael@0: michael@0: namespace mozilla { michael@0: class ErrorResult; michael@0: michael@0: namespace dom { michael@0: class GlobalObject; michael@0: template class Optional; michael@0: } michael@0: } michael@0: michael@0: BEGIN_WORKERS_NAMESPACE michael@0: michael@0: class FileReaderSync MOZ_FINAL michael@0: { michael@0: NS_INLINE_DECL_REFCOUNTING(FileReaderSync) michael@0: michael@0: private: michael@0: // Private destructor, to discourage deletion outside of Release(): michael@0: ~FileReaderSync() michael@0: { michael@0: } michael@0: michael@0: nsresult ConvertStream(nsIInputStream *aStream, const char *aCharset, michael@0: nsAString &aResult); michael@0: michael@0: public: michael@0: static already_AddRefed michael@0: Constructor(const GlobalObject& aGlobal, ErrorResult& aRv); michael@0: michael@0: JSObject* WrapObject(JSContext* aCx); michael@0: michael@0: void ReadAsArrayBuffer(JSContext* aCx, JS::Handle aScopeObj, michael@0: JS::Handle aBlob, michael@0: JS::MutableHandle aRetval, michael@0: ErrorResult& aRv); michael@0: void ReadAsBinaryString(JS::Handle aBlob, nsAString& aResult, michael@0: ErrorResult& aRv); michael@0: void ReadAsText(JS::Handle aBlob, michael@0: const Optional& aEncoding, michael@0: nsAString& aResult, ErrorResult& aRv); michael@0: void ReadAsDataURL(JS::Handle aBlob, nsAString& aResult, michael@0: ErrorResult& aRv); michael@0: }; michael@0: michael@0: END_WORKERS_NAMESPACE michael@0: michael@0: #endif // mozilla_dom_workers_filereadersync_h__