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

Side by Side Diff: Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp

Issue 797283005: replace COMPILE_ASSERT with static_assert in bindings/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "bindings/modules/v8/SerializedScriptValueForModulesFactory.h" 6 #include "bindings/modules/v8/SerializedScriptValueForModulesFactory.h"
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/SerializedScriptValue.h" 9 #include "bindings/core/v8/SerializedScriptValue.h"
10 #include "bindings/modules/v8/ScriptValueSerializerForModules.h" 10 #include "bindings/modules/v8/ScriptValueSerializerForModules.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 ScriptValueSerializerForModules serializer(writer, messagePorts, arrayBuffer s, blobInfo, blobDataHandles, tryCatch, ScriptState::current(isolate)); 56 ScriptValueSerializerForModules serializer(writer, messagePorts, arrayBuffer s, blobInfo, blobDataHandles, tryCatch, ScriptState::current(isolate));
57 ScriptValueSerializer::Status status = serializer.serialize(value); 57 ScriptValueSerializer::Status status = serializer.serialize(value);
58 errorMessage = serializer.errorMessage(); 58 errorMessage = serializer.errorMessage();
59 return status; 59 return status;
60 } 60 }
61 61
62 v8::Handle<v8::Value> SerializedScriptValueForModulesFactory::deserialize(String & data, BlobDataHandleMap& blobDataHandles, ArrayBufferContentsArray* arrayBuffe rContentsArray, v8::Isolate* isolate, MessagePortArray* messagePorts, const WebB lobInfoArray* blobInfo) 62 v8::Handle<v8::Value> SerializedScriptValueForModulesFactory::deserialize(String & data, BlobDataHandleMap& blobDataHandles, ArrayBufferContentsArray* arrayBuffe rContentsArray, v8::Isolate* isolate, MessagePortArray* messagePorts, const WebB lobInfoArray* blobInfo)
63 { 63 {
64 if (!data.impl()) 64 if (!data.impl())
65 return v8::Null(isolate); 65 return v8::Null(isolate);
66 COMPILE_ASSERT(sizeof(SerializedScriptValueWriter::BufferValueType) == 2, Bu fferValueTypeIsTwoBytes); 66 static_assert(sizeof(SerializedScriptValueWriter::BufferValueType) == 2, "Bu fferValueType should be 2 bytes");
67 data.ensure16Bit(); 67 data.ensure16Bit();
68 // FIXME: SerializedScriptValue shouldn't use String for its underlying 68 // FIXME: SerializedScriptValue shouldn't use String for its underlying
69 // storage. Instead, it should use SharedBuffer or Vector<uint8_t>. The 69 // storage. Instead, it should use SharedBuffer or Vector<uint8_t>. The
70 // information stored in m_data isn't even encoded in UTF-16. Instead, 70 // information stored in m_data isn't even encoded in UTF-16. Instead,
71 // unicode characters are encoded as UTF-8 with two code units per UChar. 71 // unicode characters are encoded as UTF-8 with two code units per UChar.
72 SerializedScriptValueReaderForModules reader(reinterpret_cast<const uint8_t* >(data.impl()->characters16()), 2 * data.length(), blobInfo, blobDataHandles, Sc riptState::current(isolate)); 72 SerializedScriptValueReaderForModules reader(reinterpret_cast<const uint8_t* >(data.impl()->characters16()), 2 * data.length(), blobInfo, blobDataHandles, Sc riptState::current(isolate));
73 ScriptValueDeserializerForModules deserializer(reader, messagePorts, arrayBu fferContentsArray); 73 ScriptValueDeserializerForModules deserializer(reader, messagePorts, arrayBu fferContentsArray);
74 return deserializer.deserialize(); 74 return deserializer.deserialize();
75 } 75 }
76 76
77 } // namespace blink 77 } // namespace blink
78 78
OLDNEW
« no previous file with comments | « Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp ('k') | Source/bindings/templates/constants.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698