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

Unified Diff: Source/bindings/v8/custom/V8BlobCustom.cpp

Issue 15877002: move constructors to new style callbacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/custom/V8AudioContextCustom.cpp ('k') | Source/bindings/v8/custom/V8DOMPointCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8BlobCustom.cpp
diff --git a/Source/bindings/v8/custom/V8BlobCustom.cpp b/Source/bindings/v8/custom/V8BlobCustom.cpp
index 33f5b7ca5b4425c634c136f58ca46e92b3d9d70e..a72173c868d949ad39973c598badb2e0739d140d 100644
--- a/Source/bindings/v8/custom/V8BlobCustom.cpp
+++ b/Source/bindings/v8/custom/V8BlobCustom.cpp
@@ -51,36 +51,45 @@ v8::Handle<v8::Object> wrap(Blob* impl, v8::Handle<v8::Object> creationContext,
return V8Blob::createWrapper(impl, creationContext, isolate);
}
-v8::Handle<v8::Value> V8Blob::constructorCustom(const v8::Arguments& args)
+void V8Blob::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
if (!args.Length()) {
RefPtr<Blob> blob = Blob::create();
- return toV8(blob.get(), args.Holder(), args.GetIsolate());
+ args.GetReturnValue().Set(toV8(blob.get(), args.Holder(), args.GetIsolate()));
+ return;
}
v8::Local<v8::Value> firstArg = args[0];
- if (!firstArg->IsArray())
- return throwTypeError("First argument of the constructor is not of type Array", args.GetIsolate());
+ if (!firstArg->IsArray()) {
+ throwTypeError("First argument of the constructor is not of type Array", args.GetIsolate());
+ return;
+ }
String type;
String endings = ASCIILiteral("transparent");
if (args.Length() > 1) {
- if (!args[1]->IsObject())
- return throwTypeError("Second argument of the constructor is not of type Object", args.GetIsolate());
+ if (!args[1]->IsObject()) {
+ throwTypeError("Second argument of the constructor is not of type Object", args.GetIsolate());
+ return;
+ }
- V8TRYCATCH(Dictionary, dictionary, Dictionary(args[1], args.GetIsolate()));
+ V8TRYCATCH_VOID(Dictionary, dictionary, Dictionary(args[1], args.GetIsolate()));
- V8TRYCATCH(bool, containsEndings, dictionary.get("endings", endings));
+ V8TRYCATCH_VOID(bool, containsEndings, dictionary.get("endings", endings));
if (containsEndings) {
- if (endings != "transparent" && endings != "native")
- return throwTypeError("The endings property must be either \"transparent\" or \"native\"", args.GetIsolate());
+ if (endings != "transparent" && endings != "native") {
+ throwTypeError("The endings property must be either \"transparent\" or \"native\"", args.GetIsolate());
+ return;
+ }
}
- V8TRYCATCH(bool, containsType, dictionary.get("type", type));
+ V8TRYCATCH_VOID(bool, containsType, dictionary.get("type", type));
UNUSED_PARAM(containsType);
- if (!type.containsOnlyASCII())
- return throwError(v8SyntaxError, "type must consist of ASCII characters", args.GetIsolate());
+ if (!type.containsOnlyASCII()) {
+ throwError(v8SyntaxError, "type must consist of ASCII characters", args.GetIsolate());
+ return;
+ }
type.makeLower();
}
@@ -88,7 +97,7 @@ v8::Handle<v8::Value> V8Blob::constructorCustom(const v8::Arguments& args)
BlobBuilder blobBuilder;
- V8TRYCATCH(v8::Local<v8::Array>, blobParts, v8::Local<v8::Array>::Cast(firstArg));
+ V8TRYCATCH_VOID(v8::Local<v8::Array>, blobParts, v8::Local<v8::Array>::Cast(firstArg));
uint32_t length = blobParts->Length();
for (uint32_t i = 0; i < length; ++i) {
@@ -108,13 +117,13 @@ v8::Handle<v8::Value> V8Blob::constructorCustom(const v8::Arguments& args)
ASSERT(blob);
blobBuilder.append(blob);
} else {
- V8TRYCATCH(String, stringValue, toWebCoreString(item));
+ V8TRYCATCH_VOID(String, stringValue, toWebCoreString(item));
blobBuilder.append(stringValue, endings);
}
}
RefPtr<Blob> blob = blobBuilder.getBlob(type);
- return toV8(blob.get(), args.Holder(), args.GetIsolate());
+ args.GetReturnValue().Set(toV8(blob.get(), args.Holder(), args.GetIsolate()));
}
} // namespace WebCore
« no previous file with comments | « Source/bindings/v8/custom/V8AudioContextCustom.cpp ('k') | Source/bindings/v8/custom/V8DOMPointCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698