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

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

Issue 482753002: Use StringBuilder::appendLiteral() / StringBuilder::append(char) when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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/dom/Node.cpp ('k') | Source/core/frame/FrameConsole.cpp » ('j') | 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 builder.append(m_decoder->flush()); 375 builder.append(m_decoder->flush());
376 376
377 m_stringResult = builder.toString(); 377 m_stringResult = builder.toString();
378 } 378 }
379 379
380 void FileReaderLoader::convertToDataURL() 380 void FileReaderLoader::convertToDataURL()
381 { 381 {
382 m_isRawDataConverted = true; 382 m_isRawDataConverted = true;
383 383
384 StringBuilder builder; 384 StringBuilder builder;
385 builder.append("data:"); 385 builder.appendLiteral("data:");
386 386
387 if (!m_bytesLoaded) { 387 if (!m_bytesLoaded) {
388 m_stringResult = builder.toString(); 388 m_stringResult = builder.toString();
389 return; 389 return;
390 } 390 }
391 391
392 builder.append(m_dataType); 392 builder.append(m_dataType);
393 builder.append(";base64,"); 393 builder.appendLiteral(";base64,");
394 394
395 Vector<char> out; 395 Vector<char> out;
396 base64Encode(static_cast<const char*>(m_rawData->data()), m_rawData->byteLen gth(), out); 396 base64Encode(static_cast<const char*>(m_rawData->data()), m_rawData->byteLen gth(), out);
397 out.append('\0'); 397 out.append('\0');
398 builder.append(out.data()); 398 builder.append(out.data());
399 399
400 m_stringResult = builder.toString(); 400 m_stringResult = builder.toString();
401 } 401 }
402 402
403 void FileReaderLoader::setEncoding(const String& encoding) 403 void FileReaderLoader::setEncoding(const String& encoding)
404 { 404 {
405 if (!encoding.isEmpty()) 405 if (!encoding.isEmpty())
406 m_encoding = WTF::TextEncoding(encoding); 406 m_encoding = WTF::TextEncoding(encoding);
407 } 407 }
408 408
409 } // namespace blink 409 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/frame/FrameConsole.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698