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

Unified Diff: Source/bindings/v8/custom/V8BlobCustomHelpers.h

Issue 57483002: Implement File constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed feedback. Created 7 years, 1 month 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
Index: Source/bindings/v8/custom/V8BlobCustomHelpers.h
diff --git a/Source/bindings/v8/ScriptPromise.cpp b/Source/bindings/v8/custom/V8BlobCustomHelpers.h
similarity index 63%
copy from Source/bindings/v8/ScriptPromise.cpp
copy to Source/bindings/v8/custom/V8BlobCustomHelpers.h
index 4b532453a4c296e0b7885adfd6984454f4845e9d..885d256a8297905054246fb55901a47c5fc66d54 100644
--- a/Source/bindings/v8/ScriptPromise.cpp
+++ b/Source/bindings/v8/custom/V8BlobCustomHelpers.h
@@ -28,32 +28,30 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#include "bindings/v8/ScriptPromise.h"
+#ifndef V8BlobCustomHelpers_h
+#define V8BlobCustomHelpers_h
#include "bindings/v8/V8Binding.h"
-#include "bindings/v8/V8DOMWrapper.h"
-#include "bindings/v8/custom/V8PromiseCustom.h"
-
-#include <v8.h>
namespace WebCore {
-ScriptPromise ScriptPromise::createPending(ExecutionContext* context)
-{
- ASSERT(v8::Context::InContext());
- ASSERT(context);
- v8::Isolate* isolate = toIsolate(context);
- v8::Handle<v8::Object> promise = V8PromiseCustom::createPromise(toV8Context(context, DOMWrapperWorld::current())->Global(), isolate);
- return ScriptPromise(promise, isolate);
-}
-
-ScriptPromise ScriptPromise::createPending()
-{
- ASSERT(v8::Context::InContext());
- v8::Isolate* isolate = v8::Isolate::GetCurrent();
- v8::Handle<v8::Object> promise = V8PromiseCustom::createPromise(v8::Object::New(), isolate);
- return ScriptPromise(promise, isolate);
-}
+class BlobBuilder;
+
+// Shared code between the custom constructor bindings for Blob and File.
+namespace V8BlobCustomHelpers {
+
+// Extracts the "type" and "endings" properties out of the BlobPropertyBag passed to a Blob constructor.
+// http://www.w3.org/TR/FileAPI/#constructorParams
+// Returns true if everything went well, false if a JS exception was thrown.
+bool processBlobPropertyBag(v8::Local<v8::Value> propertyBag, v8::Isolate*, const char* blobClassName, String& contentType, String& endings);
haraken 2013/11/15 08:40:05 Move the v8::Isolate* parameter to the end (It's a
pwnall-personal 2013/11/15 10:28:53 Done. Thank you very much for explaining!
+
+// Appends the blobParts passed to a Blob constructor into a BlobBuilder.
+// http://www.w3.org/TR/FileAPI/#constructorParams
+// Returns true if everything went well, false if a JS exception was thrown.
+bool processBlobParts(v8::Local<v8::Object> blobParts, uint32_t blobPartsLength, v8::Isolate*, const String& endings, BlobBuilder&);
haraken 2013/11/15 08:40:05 Ditto.
pwnall-personal 2013/11/15 10:28:53 Done.
+
+} // namespace V8BlobCustomHelpers
} // namespace WebCore
+
+#endif // V8BlobCustomHelpers_h

Powered by Google App Engine
This is Rietveld 408576698