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

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

Issue 2017303002: Revert of Remove StringBuilder::appendLiteral. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 builder.append(m_decoder->flush()); 377 builder.append(m_decoder->flush());
378 378
379 m_stringResult = builder.toString(); 379 m_stringResult = builder.toString();
380 } 380 }
381 381
382 void FileReaderLoader::convertToDataURL() 382 void FileReaderLoader::convertToDataURL()
383 { 383 {
384 m_isRawDataConverted = true; 384 m_isRawDataConverted = true;
385 385
386 StringBuilder builder; 386 StringBuilder builder;
387 builder.append("data:"); 387 builder.appendLiteral("data:");
388 388
389 if (!m_bytesLoaded) { 389 if (!m_bytesLoaded) {
390 m_stringResult = builder.toString(); 390 m_stringResult = builder.toString();
391 return; 391 return;
392 } 392 }
393 393
394 builder.append(m_dataType); 394 builder.append(m_dataType);
395 builder.append(";base64,"); 395 builder.appendLiteral(";base64,");
396 396
397 Vector<char> out; 397 Vector<char> out;
398 base64Encode(static_cast<const char*>(m_rawData->data()), m_rawData->byteLen gth(), out); 398 base64Encode(static_cast<const char*>(m_rawData->data()), m_rawData->byteLen gth(), out);
399 out.append('\0'); 399 out.append('\0');
400 builder.append(out.data()); 400 builder.append(out.data());
401 401
402 m_stringResult = builder.toString(); 402 m_stringResult = builder.toString();
403 } 403 }
404 404
405 void FileReaderLoader::setEncoding(const String& encoding) 405 void FileReaderLoader::setEncoding(const String& encoding)
406 { 406 {
407 if (!encoding.isEmpty()) 407 if (!encoding.isEmpty())
408 m_encoding = WTF::TextEncoding(encoding); 408 m_encoding = WTF::TextEncoding(encoding);
409 } 409 }
410 410
411 } // namespace blink 411 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698