OLD | NEW |
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 m_items.append(BlobDataItem(url, offset, length, expectedModificationTime)); | 99 m_items.append(BlobDataItem(url, offset, length, expectedModificationTime)); |
100 } | 100 } |
101 | 101 |
102 void BlobData::appendText(const String& text, bool doNormalizeLineEndingsToNativ
e) | 102 void BlobData::appendText(const String& text, bool doNormalizeLineEndingsToNativ
e) |
103 { | 103 { |
104 RefPtr<RawData> data = RawData::create(); | 104 RefPtr<RawData> data = RawData::create(); |
105 Vector<char>* buffer = data->mutableData(); | 105 Vector<char>* buffer = data->mutableData(); |
106 | 106 |
107 CString utf8Text = UTF8Encoding().normalizeAndEncode(text, WTF::EntitiesForU
nencodables); | 107 CString utf8Text = UTF8Encoding().normalizeAndEncode(text, WTF::EntitiesForU
nencodables); |
108 if (doNormalizeLineEndingsToNative) { | 108 if (doNormalizeLineEndingsToNative) { |
109 blink::normalizeLineEndingsToNative(utf8Text, *buffer); | 109 normalizeLineEndingsToNative(utf8Text, *buffer); |
110 } else { | 110 } else { |
111 buffer->append(utf8Text.data(), utf8Text.length()); | 111 buffer->append(utf8Text.data(), utf8Text.length()); |
112 } | 112 } |
113 | 113 |
114 m_items.append(BlobDataItem(data.release())); | 114 m_items.append(BlobDataItem(data.release())); |
115 } | 115 } |
116 | 116 |
117 void BlobData::appendBytes(const void* bytes, long long length) | 117 void BlobData::appendBytes(const void* bytes, long long length) |
118 { | 118 { |
119 RefPtr<RawData> data = RawData::create(); | 119 RefPtr<RawData> data = RawData::create(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 { | 184 { |
185 BlobRegistry::addBlobDataRef(m_uuid); | 185 BlobRegistry::addBlobDataRef(m_uuid); |
186 } | 186 } |
187 | 187 |
188 BlobDataHandle::~BlobDataHandle() | 188 BlobDataHandle::~BlobDataHandle() |
189 { | 189 { |
190 BlobRegistry::removeBlobDataRef(m_uuid); | 190 BlobRegistry::removeBlobDataRef(m_uuid); |
191 } | 191 } |
192 | 192 |
193 } // namespace blink | 193 } // namespace blink |
OLD | NEW |