Index: Source/bindings/core/v8/SerializedScriptValue.cpp |
diff --git a/Source/bindings/v8/SerializedScriptValue.cpp b/Source/bindings/core/v8/SerializedScriptValue.cpp |
similarity index 98% |
rename from Source/bindings/v8/SerializedScriptValue.cpp |
rename to Source/bindings/core/v8/SerializedScriptValue.cpp |
index e0f3e75a44087a64cc6d43cacbbe5804096b956b..6a417f7a3ec58d2150ad9c4f51cc6229db76ca39 100644 |
--- a/Source/bindings/v8/SerializedScriptValue.cpp |
+++ b/Source/bindings/core/v8/SerializedScriptValue.cpp |
@@ -29,13 +29,16 @@ |
*/ |
#include "config.h" |
-#include "bindings/v8/SerializedScriptValue.h" |
+#include "bindings/core/v8/SerializedScriptValue.h" |
+#include "bindings/core/v8/ExceptionState.h" |
+#include "bindings/core/v8/V8Binding.h" |
#include "bindings/core/v8/V8Blob.h" |
#include "bindings/core/v8/V8File.h" |
#include "bindings/core/v8/V8FileList.h" |
#include "bindings/core/v8/V8ImageData.h" |
#include "bindings/core/v8/V8MessagePort.h" |
+#include "bindings/core/v8/WorkerScriptController.h" |
#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" |
#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" |
#include "bindings/core/v8/custom/V8DataViewCustom.h" |
@@ -50,9 +53,6 @@ |
#include "bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h" |
#include "bindings/modules/v8/V8CryptoKey.h" |
#include "bindings/modules/v8/V8DOMFileSystem.h" |
-#include "bindings/v8/ExceptionState.h" |
-#include "bindings/v8/V8Binding.h" |
-#include "bindings/v8/WorkerScriptController.h" |
#include "core/dom/ExceptionCode.h" |
#include "core/dom/MessagePort.h" |
#include "core/fileapi/Blob.h" |
@@ -371,9 +371,9 @@ public: |
ensureSpace(utf8Length); |
// ASCII fast path. |
- if (stringLength == utf8Length) |
+ if (stringLength == utf8Length) { |
string->WriteOneByte(byteAt(m_position), 0, utf8Length, v8StringWriteOptions()); |
- else { |
+ } else { |
char* buffer = reinterpret_cast<char*>(byteAt(m_position)); |
string->WriteUtf8(buffer, utf8Length, 0, v8StringWriteOptions()); |
} |
@@ -1084,9 +1084,9 @@ private: |
bool hasIndexedProperty = !hasStringProperty && propertyName->IsUint32() && composite()->HasRealIndexedProperty(propertyName->Uint32Value()); |
if (StateBase* newState = serializer.checkException(this)) |
return newState; |
- if (hasStringProperty || (hasIndexedProperty && !ignoreIndexed)) |
+ if (hasStringProperty || (hasIndexedProperty && !ignoreIndexed)) { |
m_propertyName = propertyName; |
- else { |
+ } else { |
++m_index; |
continue; |
} |
@@ -1522,70 +1522,72 @@ Serializer::StateBase* Serializer::doSerialize(v8::Handle<v8::Value> value, Stat |
m_writer.writeObjectReference(objectReference); |
} else if (value.IsEmpty()) { |
return handleError(InputError, "The empty property name cannot be cloned.", next); |
- } else if (value->IsUndefined()) |
+ } else if (value->IsUndefined()) { |
m_writer.writeUndefined(); |
- else if (value->IsNull()) |
+ } else if (value->IsNull()) { |
m_writer.writeNull(); |
- else if (value->IsTrue()) |
+ } else if (value->IsTrue()) { |
m_writer.writeTrue(); |
- else if (value->IsFalse()) |
+ } else if (value->IsFalse()) { |
m_writer.writeFalse(); |
- else if (value->IsInt32()) |
+ } else if (value->IsInt32()) { |
m_writer.writeInt32(value->Int32Value()); |
- else if (value->IsUint32()) |
+ } else if (value->IsUint32()) { |
m_writer.writeUint32(value->Uint32Value()); |
- else if (value->IsNumber()) |
+ } else if (value->IsNumber()) { |
m_writer.writeNumber(value.As<v8::Number>()->Value()); |
- else if (V8ArrayBufferView::hasInstance(value, isolate())) |
+ } else if (V8ArrayBufferView::hasInstance(value, isolate())) { |
return writeAndGreyArrayBufferView(value.As<v8::Object>(), next); |
- else if (value->IsString()) |
+ } else if (value->IsString()) { |
writeString(value); |
- else if (V8MessagePort::hasInstance(value, isolate())) { |
+ } else if (V8MessagePort::hasInstance(value, isolate())) { |
uint32_t messagePortIndex; |
- if (m_transferredMessagePorts.tryGet(value.As<v8::Object>(), &messagePortIndex)) |
- m_writer.writeTransferredMessagePort(messagePortIndex); |
- else |
- return handleError(DataCloneError, "A MessagePort could not be cloned.", next); |
- } else if (V8ArrayBuffer::hasInstance(value, isolate()) && m_transferredArrayBuffers.tryGet(value.As<v8::Object>(), &arrayBufferIndex)) |
+ if (m_transferredMessagePorts.tryGet(value.As<v8::Object>(), &messagePortIndex)) { |
+ m_writer.writeTransferredMessagePort(messagePortIndex); |
+ } else { |
+ return handleError(DataCloneError, "A MessagePort could not be cloned.", next); |
+ } |
+ } else if (V8ArrayBuffer::hasInstance(value, isolate()) && m_transferredArrayBuffers.tryGet(value.As<v8::Object>(), &arrayBufferIndex)) { |
return writeTransferredArrayBuffer(value, arrayBufferIndex, next); |
- else { |
+ } else { |
v8::Handle<v8::Object> jsObject = value.As<v8::Object>(); |
if (jsObject.IsEmpty()) |
return handleError(DataCloneError, "An object could not be cloned.", next); |
greyObject(jsObject); |
- if (value->IsDate()) |
+ if (value->IsDate()) { |
m_writer.writeDate(value->NumberValue()); |
- else if (value->IsStringObject()) |
+ } else if (value->IsStringObject()) { |
writeStringObject(value); |
- else if (value->IsNumberObject()) |
+ } else if (value->IsNumberObject()) { |
writeNumberObject(value); |
- else if (value->IsBooleanObject()) |
+ } else if (value->IsBooleanObject()) { |
writeBooleanObject(value); |
- else if (value->IsArray()) { |
+ } else if (value->IsArray()) { |
return startArrayState(value.As<v8::Array>(), next); |
- } else if (V8File::hasInstance(value, isolate())) |
+ } else if (V8File::hasInstance(value, isolate())) { |
return writeFile(value, next); |
- else if (V8Blob::hasInstance(value, isolate())) |
+ } else if (V8Blob::hasInstance(value, isolate())) { |
return writeBlob(value, next); |
- else if (V8DOMFileSystem::hasInstance(value, isolate())) |
+ } else if (V8DOMFileSystem::hasInstance(value, isolate())) { |
return writeDOMFileSystem(value, next); |
- else if (V8FileList::hasInstance(value, isolate())) |
+ } else if (V8FileList::hasInstance(value, isolate())) { |
return writeFileList(value, next); |
- else if (V8CryptoKey::hasInstance(value, isolate())) { |
+ } else if (V8CryptoKey::hasInstance(value, isolate())) { |
if (!writeCryptoKey(value)) |
return handleError(DataCloneError, "Couldn't serialize key data", next); |
- } else if (V8ImageData::hasInstance(value, isolate())) |
+ } else if (V8ImageData::hasInstance(value, isolate())) { |
writeImageData(value); |
- else if (value->IsRegExp()) |
+ } else if (value->IsRegExp()) { |
writeRegExp(value); |
- else if (V8ArrayBuffer::hasInstance(value, isolate())) |
+ } else if (V8ArrayBuffer::hasInstance(value, isolate())) { |
return writeArrayBuffer(value, next); |
- else if (value->IsObject()) { |
+ } else if (value->IsObject()) { |
if (isHostObject(jsObject) || jsObject->IsCallable() || value->IsNativeError()) |
return handleError(DataCloneError, "An object could not be cloned.", next); |
return startObjectState(jsObject, next); |
- } else |
+ } else { |
return handleError(DataCloneError, "A value could not be cloned.", next); |
+ } |
} |
return 0; |
} |