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 25 matching lines...) Expand all Loading... |
36 #include "platform/text/LineEnding.h" | 36 #include "platform/text/LineEnding.h" |
37 #include "wtf/ArrayBuffer.h" | 37 #include "wtf/ArrayBuffer.h" |
38 #include "wtf/ArrayBufferView.h" | 38 #include "wtf/ArrayBufferView.h" |
39 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
40 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
41 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
42 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
43 #include "wtf/text/CString.h" | 43 #include "wtf/text/CString.h" |
44 #include "wtf/text/TextEncoding.h" | 44 #include "wtf/text/TextEncoding.h" |
45 | 45 |
46 namespace WebCore { | 46 namespace blink { |
47 | 47 |
48 const long long BlobDataItem::toEndOfFile = -1; | 48 const long long BlobDataItem::toEndOfFile = -1; |
49 | 49 |
50 RawData::RawData() | 50 RawData::RawData() |
51 { | 51 { |
52 } | 52 } |
53 | 53 |
54 void RawData::detachFromCurrentThread() | 54 void RawData::detachFromCurrentThread() |
55 { | 55 { |
56 } | 56 } |
(...skipping 42 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 WebCore::normalizeLineEndingsToNative(utf8Text, *buffer); | 109 blink::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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 , m_size(size) | 183 , m_size(size) |
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 WebCore | 193 } // namespace blink |
OLD | NEW |