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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h

Issue 2101953002: [Refactoring] Clean up code for serializing ScriptValues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
index 15b23b9623ba313238597fb1125296fbac38168d..84c8b69535c763cb181eca2af1d077b5c2062de1 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
@@ -110,12 +110,11 @@ public:
{
}
- // TODO(peria): Protect this mehtod.
- String takeWireString();
-
protected:
friend class ScriptValueSerializer;
+ String takeWireString();
+
// Write functions for primitive types.
void writeUndefined();
void writeNull();
@@ -212,12 +211,11 @@ protected:
};
public:
- ScriptValueSerializer(SerializedScriptValueWriter&, const Transferables*, WebBlobInfoArray*, ScriptState*);
+ ScriptValueSerializer(SerializedScriptValueWriter&, WebBlobInfoArray*, ScriptState*);
v8::Isolate* isolate() { return m_scriptState->isolate(); }
v8::Local<v8::Context> context() { return m_scriptState->context(); }
PassRefPtr<SerializedScriptValue> serialize(v8::Local<v8::Value>, Transferables*, ExceptionState&);
- String errorMessage() { return m_errorMessage; }
static String serializeWTFString(const String&);
static String serializeNullValue();
@@ -368,9 +366,16 @@ protected:
typedef CollectionState<v8::Map> MapState;
typedef CollectionState<v8::Set> SetState;
- // Functions used by serialization states.
virtual StateBase* doSerializeObject(v8::Local<v8::Object>, StateBase* next);
+ // Marks object as having been visited by the serializer and assigns it a unique object reference ID.
+ // An object may only be greyed once.
+ void greyObject(const v8::Local<v8::Object>&);
+
+ StateBase* handleError(Status errorStatus, const String& message, StateBase*);
+
+ SerializedScriptValueWriter& writer() { return m_writer; }
+
private:
StateBase* doSerialize(v8::Local<v8::Value>, StateBase* next);
StateBase* doSerializeArrayBuffer(v8::Local<v8::Value> arrayBuffer, StateBase* next);
@@ -425,18 +430,6 @@ private:
bool appendBlobInfo(const String& uuid, const String& type, unsigned long long size, int* index);
bool appendFileInfo(const File*, int* index);
-protected:
- // Marks object as having been visited by the serializer and assigns it a unique object reference ID.
- // An object may only be greyed once.
- void greyObject(const v8::Local<v8::Object>&);
-
- StateBase* handleError(Status errorStatus, const String& message, StateBase*);
-
- SerializedScriptValueWriter& writer() { return m_writer; }
- uint32_t nextObjectReference() const { return m_nextObjectReference; }
-
-private:
-
void copyTransferables(const Transferables&);
RefPtr<ScriptState> m_scriptState;
@@ -481,6 +474,10 @@ public:
ScriptState* getScriptState() const { return m_scriptState.get(); }
+ virtual bool read(v8::Local<v8::Value>*, ScriptValueDeserializer&);
+ bool readVersion(uint32_t& version);
+ void setVersion(uint32_t);
+
protected:
v8::Isolate* isolate() const { return m_scriptState->isolate(); }
v8::Local<v8::Context> context() const { return m_scriptState->context(); }
@@ -494,12 +491,6 @@ protected:
return allocated;
}
-public:
- virtual bool read(v8::Local<v8::Value>*, ScriptValueDeserializer&);
- bool readVersion(uint32_t& version);
- void setVersion(uint32_t);
-
-protected:
bool readWithTag(SerializationTag, v8::Local<v8::Value>*, ScriptValueDeserializer&);
bool readTag(SerializationTag*);
@@ -552,7 +543,6 @@ private:
bool doReadNumber(double* number);
PassRefPtr<BlobDataHandle> getOrCreateBlobDataHandle(const String& uuid, const String& type, long long size = -1);
-private:
RefPtr<ScriptState> m_scriptState;
const uint8_t* m_buffer;
const unsigned m_length;

Powered by Google App Engine
This is Rietveld 408576698