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

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

Issue 1116843002: v8::Isolate* should be the first parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed Mac compilation error for v8::Isolate* should be the first parameter patch Created 5 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 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"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 PassRefPtr<SerializedScriptValue> SerializedScriptValueForModulesFactory::create (v8::Local<v8::Value> value, MessagePortArray* messagePorts, ArrayBufferArray* a rrayBuffers, WebBlobInfoArray* blobInfo, ExceptionState& exceptionState, v8::Iso late* isolate) 15 PassRefPtr<SerializedScriptValue> SerializedScriptValueForModulesFactory::create (v8::Isolate* isolate, v8::Local<v8::Value> value, MessagePortArray* messagePort s, ArrayBufferArray* arrayBuffers, WebBlobInfoArray* blobInfo, ExceptionState& e xceptionState)
16 { 16 {
17 RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValueFactory ::create(); 17 RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValueFactory ::create();
18 SerializedScriptValueWriterForModules writer; 18 SerializedScriptValueWriterForModules writer;
19 ScriptValueSerializer::Status status; 19 ScriptValueSerializer::Status status;
20 String errorMessage; 20 String errorMessage;
21 { 21 {
22 v8::TryCatch tryCatch; 22 v8::TryCatch tryCatch;
23 status = SerializedScriptValueFactory::doSerialize(value, writer, messag ePorts, arrayBuffers, blobInfo, serializedValue.get(), tryCatch, errorMessage, i solate); 23 status = SerializedScriptValueFactory::doSerialize(value, writer, messag ePorts, arrayBuffers, blobInfo, serializedValue.get(), tryCatch, errorMessage, i solate);
24 if (status == ScriptValueSerializer::JSException) { 24 if (status == ScriptValueSerializer::JSException) {
25 // If there was a JS exception thrown, re-throw it. 25 // If there was a JS exception thrown, re-throw it.
(...skipping 10 matching lines...) Expand all
36 transferData(serializedValue.get(), writer, arrayBuffers, exceptionState , isolate); 36 transferData(serializedValue.get(), writer, arrayBuffers, exceptionState , isolate);
37 return serializedValue.release(); 37 return serializedValue.release();
38 case ScriptValueSerializer::JSException: 38 case ScriptValueSerializer::JSException:
39 ASSERT_NOT_REACHED(); 39 ASSERT_NOT_REACHED();
40 break; 40 break;
41 } 41 }
42 ASSERT_NOT_REACHED(); 42 ASSERT_NOT_REACHED();
43 return serializedValue.release(); 43 return serializedValue.release();
44 } 44 }
45 45
46 PassRefPtr<SerializedScriptValue> SerializedScriptValueForModulesFactory::create (const String& data, v8::Isolate* isolate) 46 PassRefPtr<SerializedScriptValue> SerializedScriptValueForModulesFactory::create (v8::Isolate* isolate, const String& data)
47 { 47 {
48 SerializedScriptValueWriterForModules writer; 48 SerializedScriptValueWriterForModules writer;
49 writer.writeWebCoreString(data); 49 writer.writeWebCoreString(data);
50 String wireData = writer.takeWireString(); 50 String wireData = writer.takeWireString();
51 return createFromWire(wireData); 51 return createFromWire(wireData);
52 } 52 }
53 53
54 ScriptValueSerializer::Status SerializedScriptValueForModulesFactory::doSerializ e(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, MessagePortAr ray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray* blobInfo, B lobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate) 54 ScriptValueSerializer::Status SerializedScriptValueForModulesFactory::doSerializ e(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, MessagePortAr ray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray* blobInfo, B lobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate)
55 { 55 {
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));
(...skipping 12 matching lines...) Expand all
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/SerializedScriptValueForModulesFactory.h ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698