Index: src/api.cc |
=================================================================== |
--- src/api.cc (revision 2663) |
+++ src/api.cc (working copy) |
@@ -2986,7 +2986,7 @@ |
if (IsDeadCheck("v8::String::MakeExternal()")) return false; |
if (this->IsExternal()) return false; // Already an external string. |
ENTER_V8; |
- i::Handle <i::String> obj = Utils::OpenHandle(this); |
+ i::Handle<i::String> obj = Utils::OpenHandle(this); |
bool result = obj->MakeExternal(resource); |
if (result && !obj->IsSymbol()) { |
// Operation was successful and the string is not a symbol. In this case |
@@ -3022,7 +3022,7 @@ |
if (IsDeadCheck("v8::String::MakeExternal()")) return false; |
if (this->IsExternal()) return false; // Already an external string. |
ENTER_V8; |
- i::Handle <i::String> obj = Utils::OpenHandle(this); |
+ i::Handle<i::String> obj = Utils::OpenHandle(this); |
bool result = obj->MakeExternal(resource); |
if (result && !obj->IsSymbol()) { |
// Operation was successful and the string is not a symbol. In this case |
@@ -3037,6 +3037,14 @@ |
} |
+bool v8::String::CanMakeExternal() { |
+ if (IsDeadCheck("v8::String::CanMakeExternal()")) return false; |
+ i::Handle<i::String> obj = Utils::OpenHandle(this); |
+ int size = obj->Size(); // Byte size of the original string. |
+ return (size >= i::ExternalString::kSize) && !obj->IsExternalString(); |
+} |
+ |
+ |
Local<v8::Object> v8::Object::New() { |
EnsureInitialized("v8::Object::New()"); |
LOG_API("Object::New"); |