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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp

Issue 2017543002: [Binding] [Refactoring] Make SerializedScriptValueWriter protected (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: writeNull() Created 4 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "bindings/core/v8/SerializedScriptValueFactory.h" 5 #include "bindings/core/v8/SerializedScriptValueFactory.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptValueSerializer.h" 8 #include "bindings/core/v8/ScriptValueSerializer.h"
9 #include "bindings/core/v8/Transferables.h" 9 #include "bindings/core/v8/Transferables.h"
10 #include "core/dom/DOMArrayBuffer.h" 10 #include "core/dom/DOMArrayBuffer.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 ASSERT_NOT_REACHED(); 46 ASSERT_NOT_REACHED();
47 return serializedValue.release(); 47 return serializedValue.release();
48 } 48 }
49 49
50 PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isola te* isolate, v8::Local<v8::Value> value, Transferables* transferables, WebBlobIn foArray* blobInfo, ExceptionState& exceptionState) 50 PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isola te* isolate, v8::Local<v8::Value> value, Transferables* transferables, WebBlobIn foArray* blobInfo, ExceptionState& exceptionState)
51 { 51 {
52 SerializedScriptValueWriter writer; 52 SerializedScriptValueWriter writer;
53 return create(isolate, value, writer, transferables, blobInfo, exceptionStat e); 53 return create(isolate, value, writer, transferables, blobInfo, exceptionStat e);
54 } 54 }
55 55
56 PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(const Str ing& data)
57 {
58 SerializedScriptValueWriter writer;
59 writer.writeWebCoreString(data);
60 String wireData = writer.takeWireString();
61 return SerializedScriptValue::create(wireData);
62 }
63
64 void SerializedScriptValueFactory::transferData(SerializedScriptValue* serialize dValue, SerializedScriptValueWriter& writer, Transferables* transferables, Excep tionState& exceptionState, v8::Isolate* isolate) 56 void SerializedScriptValueFactory::transferData(SerializedScriptValue* serialize dValue, SerializedScriptValueWriter& writer, Transferables* transferables, Excep tionState& exceptionState, v8::Isolate* isolate)
65 { 57 {
66 serializedValue->setData(writer.takeWireString()); 58 serializedValue->setData(writer.takeWireString());
67 ASSERT(serializedValue->data().impl()->hasOneRef()); 59 ASSERT(serializedValue->data().impl()->hasOneRef());
68 if (!transferables) 60 if (!transferables)
69 return; 61 return;
70 62
71 serializedValue->transferImageBitmaps(isolate, transferables->imageBitmaps, exceptionState); 63 serializedValue->transferImageBitmaps(isolate, transferables->imageBitmaps, exceptionState);
72 if (exceptionState.hadException()) 64 if (exceptionState.hadException())
73 return; 65 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 SerializedScriptValueReader reader(reinterpret_cast<const uint8_t*>(data.imp l()->characters16()), 2 * data.length(), blobInfo, blobDataHandles, ScriptState: :current(isolate)); 98 SerializedScriptValueReader reader(reinterpret_cast<const uint8_t*>(data.imp l()->characters16()), 2 * data.length(), blobInfo, blobDataHandles, ScriptState: :current(isolate));
107 ScriptValueDeserializer deserializer(reader, messagePorts, arrayBufferConten tsArray, imageBitmapContentsArray); 99 ScriptValueDeserializer deserializer(reader, messagePorts, arrayBufferConten tsArray, imageBitmapContentsArray);
108 100
109 // deserialize() can run arbitrary script (e.g., setters), which could resul t in |this| being destroyed. 101 // deserialize() can run arbitrary script (e.g., setters), which could resul t in |this| being destroyed.
110 // Holding a RefPtr ensures we are alive (along with our internal data) thro ughout the operation. 102 // Holding a RefPtr ensures we are alive (along with our internal data) thro ughout the operation.
111 return deserializer.deserialize(); 103 return deserializer.deserialize();
112 } 104 }
113 105
114 106
115 } // namespace blink 107 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698