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

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

Issue 2716733006: SerializedScriptValue: Remove the 16-bit string representation. (Closed)
Patch Set: SSV::data can now be const Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
index 7799d5bdeb580f4e500a39f68bac3c5b9629a4f3..903256dcb5535e68d9b2865fad6b132b736a0a5c 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
@@ -134,27 +134,8 @@ class CORE_EXPORT SerializedScriptValue
// The memory registration is revoked automatically in destructor.
void registerMemoryAllocatedWithCurrentScriptContext();
- // Provides access to the data and its attributes, regardless of whether the
- // data was created as a string or as a vector.
- // TODO(jbroman): Remove the 16-bit string representation, and simplify.
- const uint8_t* data() {
- if (!m_dataString.isNull()) {
- DCHECK(!m_dataBuffer);
- m_dataString.ensure16Bit();
- return reinterpret_cast<const uint8_t*>(m_dataString.characters16());
- }
- return m_dataBuffer.get();
- }
- size_t dataLengthInBytes() const {
- if (!m_dataString.isNull())
- return m_dataString.length() * 2;
- return m_dataBufferSize;
- }
- bool dataHasOneRef() const {
- if (!m_dataString.isNull())
- return m_dataString.impl()->hasOneRef();
- return true;
- }
+ const uint8_t* data() const { return m_dataBuffer.get(); }
+ size_t dataLengthInBytes() const { return m_dataBufferSize; }
BlobDataHandleMap& blobDataHandles() { return m_blobDataHandles; }
ArrayBufferContentsArray* getArrayBufferContentsArray() {
@@ -176,13 +157,7 @@ class CORE_EXPORT SerializedScriptValue
SerializedScriptValue();
explicit SerializedScriptValue(const String& wireData);
- void setData(const String& data) {
- m_dataString = data;
- m_dataBuffer.reset();
- m_dataBufferSize = 0;
- }
void setData(DataBufferPtr data, size_t size) {
- m_dataString = String();
m_dataBuffer = std::move(data);
m_dataBufferSize = size;
}
@@ -197,14 +172,6 @@ class CORE_EXPORT SerializedScriptValue
const OffscreenCanvasArray&,
ExceptionState&);
- // Either:
- // - |m_dataString| is non-null, and contains the data as a WTF::String which,
- // when made 16-bit, is the serialized data (padded to a two-byte boundary),
- // or
- // - |m_dataBuffer| is non-null, and |m_dataBufferSize| contains its size;
- // unlike |m_dataString|, that size is not guaranteed to be padded to a
- // two-byte boundary
- String m_dataString;
DataBufferPtr m_dataBuffer;
size_t m_dataBufferSize = 0;
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698