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

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

Issue 1305393006: Don't NFC-normalize strings during Blob/File construction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/files/blob-constructor-expected.txt ('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 /* 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, bool doNormalizeLineEndingsToNativ e)
128 { 128 {
129 CString utf8Text = UTF8Encoding().normalizeAndEncode(text, WTF::EntitiesForU nencodables); 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 if (doNormalizeLineEndingsToNative) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 { 219 {
220 BlobRegistry::addBlobDataRef(m_uuid); 220 BlobRegistry::addBlobDataRef(m_uuid);
221 } 221 }
222 222
223 BlobDataHandle::~BlobDataHandle() 223 BlobDataHandle::~BlobDataHandle()
224 { 224 {
225 BlobRegistry::removeBlobDataRef(m_uuid); 225 BlobRegistry::removeBlobDataRef(m_uuid);
226 } 226 }
227 227
228 } // namespace blink 228 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/files/blob-constructor-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698