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

Side by Side Diff: third_party/WebKit/Source/platform/blob/BlobData.cpp

Issue 2147633002: Remove nonstandard 'endings' option for Blob/File constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Layout test updates Created 4 years, 5 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void BlobData::appendBlob(PassRefPtr<BlobDataHandle> dataHandle, long long offse t, long long length) 117 void BlobData::appendBlob(PassRefPtr<BlobDataHandle> dataHandle, long long offse t, long long length)
118 { 118 {
119 m_items.append(BlobDataItem(dataHandle, offset, length)); 119 m_items.append(BlobDataItem(dataHandle, offset, length));
120 } 120 }
121 121
122 void BlobData::appendFileSystemURL(const KURL& url, long long offset, long long length, double expectedModificationTime) 122 void BlobData::appendFileSystemURL(const KURL& url, long long offset, long long length, double expectedModificationTime)
123 { 123 {
124 m_items.append(BlobDataItem(url, offset, length, expectedModificationTime)); 124 m_items.append(BlobDataItem(url, offset, length, expectedModificationTime));
125 } 125 }
126 126
127 void BlobData::appendText(const String& text, bool doNormalizeLineEndingsToNativ e) 127 void BlobData::appendText(const String& text)
128 { 128 {
129 CString utf8Text = UTF8Encoding().encode(text, WTF::EntitiesForUnencodables) ; 129 CString utf8Text = UTF8Encoding().encode(text, WTF::EntitiesForUnencodables) ;
130 RefPtr<RawData> data = nullptr; 130 RefPtr<RawData> data = nullptr;
131 Vector<char>* buffer; 131 Vector<char>* buffer;
132 if (canConsolidateData(text.length())) { 132 if (canConsolidateData(text.length())) {
133 buffer = m_items.last().data->mutableData(); 133 buffer = m_items.last().data->mutableData();
134 } else { 134 } else {
135 data = RawData::create(); 135 data = RawData::create();
136 buffer = data->mutableData(); 136 buffer = data->mutableData();
137 } 137 }
138 138
139 if (doNormalizeLineEndingsToNative) { 139 buffer->append(utf8Text.data(), utf8Text.length());
140 normalizeLineEndingsToNative(utf8Text, *buffer);
141 } else {
142 buffer->append(utf8Text.data(), utf8Text.length());
143 }
144 140
145 if (data) 141 if (data)
146 m_items.append(BlobDataItem(data.release())); 142 m_items.append(BlobDataItem(data.release()));
147 } 143 }
148 144
149 void BlobData::appendBytes(const void* bytes, size_t length) 145 void BlobData::appendBytes(const void* bytes, size_t length)
150 { 146 {
151 if (canConsolidateData(length)) { 147 if (canConsolidateData(length)) {
152 m_items.last().data->mutableData()->append( 148 m_items.last().data->mutableData()->append(
153 static_cast<const char*>(bytes), 149 static_cast<const char*>(bytes),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 { 215 {
220 BlobRegistry::addBlobDataRef(m_uuid); 216 BlobRegistry::addBlobDataRef(m_uuid);
221 } 217 }
222 218
223 BlobDataHandle::~BlobDataHandle() 219 BlobDataHandle::~BlobDataHandle()
224 { 220 {
225 BlobRegistry::removeBlobDataRef(m_uuid); 221 BlobRegistry::removeBlobDataRef(m_uuid);
226 } 222 }
227 223
228 } // namespace blink 224 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698