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

Side by Side Diff: Source/core/fileapi/FileReaderLoader.cpp

Issue 6231550869897216: Remove dead code behind ENABLE(STREAM) guards (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fileapi/FileReaderLoader.h ('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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return 0; 267 return 0;
268 268
269 // If completed, we can simply return our buffer. 269 // If completed, we can simply return our buffer.
270 if (isCompleted()) 270 if (isCompleted())
271 return m_rawData; 271 return m_rawData;
272 272
273 // Otherwise, return a copy. 273 // Otherwise, return a copy.
274 return m_rawData->slice(0, m_bytesLoaded); 274 return m_rawData->slice(0, m_bytesLoaded);
275 } 275 }
276 276
277 #if ENABLE(STREAM)
278 PassRefPtr<Blob> FileReaderLoader::blobResult()
279 {
280 ASSERT(m_readType == ReadAsBlob);
281
282 // If the loading is not finished or an error occurs, return an empty result .
283 if (!m_rawData || m_errorCode || !isCompleted())
284 return 0;
285
286 if (!m_blobResult) {
287 OwnPtr<BlobData> blobData = BlobData::create();
288 size_t size = 0;
289 RefPtr<RawData> rawData = RawData::create();
290 size = m_rawData->byteLength();
291 rawData->mutableData()->append(static_cast<char*>(m_rawData->data()), si ze);
292 blobData->appendData(rawData, 0, size);
293 blobData->setContentType(m_dataType);
294 m_blobResult = Blob::create(blobData.release(), size);
295 }
296 return m_blobResult;
297 }
298 #endif // ENABLE(STREAM)
299
300 String FileReaderLoader::stringResult() 277 String FileReaderLoader::stringResult()
301 { 278 {
302 ASSERT(m_readType != ReadAsArrayBuffer && m_readType != ReadAsBlob); 279 ASSERT(m_readType != ReadAsArrayBuffer && m_readType != ReadAsBlob);
303 280
304 // If the loading is not started or an error occurs, return an empty result. 281 // If the loading is not started or an error occurs, return an empty result.
305 if (!m_rawData || m_errorCode) 282 if (!m_rawData || m_errorCode)
306 return m_stringResult; 283 return m_stringResult;
307 284
308 // If already converted from the raw data, return the result now. 285 // If already converted from the raw data, return the result now.
309 if (m_isRawDataConverted) 286 if (m_isRawDataConverted)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 { 354 {
378 return m_bytesLoaded == m_totalBytes; 355 return m_bytesLoaded == m_totalBytes;
379 } 356 }
380 357
381 void FileReaderLoader::setEncoding(const String& encoding) 358 void FileReaderLoader::setEncoding(const String& encoding)
382 { 359 {
383 if (!encoding.isEmpty()) 360 if (!encoding.isEmpty())
384 m_encoding = WTF::TextEncoding(encoding); 361 m_encoding = WTF::TextEncoding(encoding);
385 } 362 }
386 363
387 #if ENABLE(STREAM)
388 void FileReaderLoader::setRange(unsigned start, unsigned length)
389 {
390 ASSERT(length > 0);
391 m_hasRange = true;
392 m_rangeStart = start;
393 m_rangeEnd = start + length - 1;
394 }
395 #endif // ENABLE(STREAM)
396
397 } // namespace WebCore 364 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/fileapi/FileReaderLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698