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

Unified Diff: src/extensions/externalize-string-extension.cc

Issue 15793007: Cutover v8 to use new style callbacks internally (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | « src/extensions/externalize-string-extension.h ('k') | src/extensions/gc-extension.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/extensions/externalize-string-extension.cc
diff --git a/src/extensions/externalize-string-extension.cc b/src/extensions/externalize-string-extension.cc
index 0f6b639fa1ec9d8817e0bdf2c46987b3594dace9..a3630fb9f5b5253c6483c768589820e55502094c 100644
--- a/src/extensions/externalize-string-extension.cc
+++ b/src/extensions/externalize-string-extension.cc
@@ -72,26 +72,29 @@ v8::Handle<v8::FunctionTemplate> ExternalizeStringExtension::GetNativeFunction(
}
-v8::Handle<v8::Value> ExternalizeStringExtension::Externalize(
- const v8::Arguments& args) {
+void ExternalizeStringExtension::Externalize(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() < 1 || !args[0]->IsString()) {
- return v8::ThrowException(v8::String::New(
+ v8::ThrowException(v8::String::New(
"First parameter to externalizeString() must be a string."));
+ return;
}
bool force_two_byte = false;
if (args.Length() >= 2) {
if (args[1]->IsBoolean()) {
force_two_byte = args[1]->BooleanValue();
} else {
- return v8::ThrowException(v8::String::New(
- "Second parameter to externalizeString() must be a boolean."));
+ v8::ThrowException(v8::String::New(
+ "Second parameter to externalizeString() must be a boolean."));
+ return;
}
}
bool result = false;
Handle<String> string = Utils::OpenHandle(*args[0].As<v8::String>());
if (string->IsExternalString()) {
- return v8::ThrowException(v8::String::New(
+ v8::ThrowException(v8::String::New(
"externalizeString() can't externalize twice."));
+ return;
}
if (string->IsOneByteRepresentation() && !force_two_byte) {
uint8_t* data = new uint8_t[string->length()];
@@ -115,21 +118,22 @@ v8::Handle<v8::Value> ExternalizeStringExtension::Externalize(
if (!result) delete resource;
}
if (!result) {
- return v8::ThrowException(v8::String::New("externalizeString() failed."));
+ v8::ThrowException(v8::String::New("externalizeString() failed."));
+ return;
}
- return v8::Undefined();
}
-v8::Handle<v8::Value> ExternalizeStringExtension::IsAscii(
- const v8::Arguments& args) {
+void ExternalizeStringExtension::IsAscii(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1 || !args[0]->IsString()) {
- return v8::ThrowException(v8::String::New(
+ v8::ThrowException(v8::String::New(
"isAsciiString() requires a single string argument."));
+ return;
}
- return
- Utils::OpenHandle(*args[0].As<v8::String>())->IsOneByteRepresentation() ?
- v8::True() : v8::False();
+ bool is_one_byte =
+ Utils::OpenHandle(*args[0].As<v8::String>())->IsOneByteRepresentation();
+ args.GetReturnValue().Set(is_one_byte);
}
« no previous file with comments | « src/extensions/externalize-string-extension.h ('k') | src/extensions/gc-extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698