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

Unified Diff: third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h

Issue 2235113002: Use StringView for String::append and ::insert. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix appendHex stuff. Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h
index 2506af4e00842c49be6d5ccd8afc48e7940f5f76..52986bec48af7ae0352f5c2eab867e492227ea1d 100644
--- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h
+++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h
@@ -88,18 +88,26 @@ public:
void recordAttach(const String& handle)
{
MutexLocker locker(m_loggingMutex);
- m_result.append("A reader is attached to " + handle + " on " + currentThreadName() + ".\n");
+ m_result.append("A reader is attached to ");
+ m_result.append(handle);
+ m_result.append(" on ");
+ m_result.append(currentThreadName());
+ m_result.append(".\n");
}
void recordDetach(const String& handle)
{
MutexLocker locker(m_loggingMutex);
- m_result.append("A reader is detached from " + handle + " on " + currentThreadName() + ".\n");
+ m_result.append("A reader is detached from ");
+ m_result.append(handle);
+ m_result.append(" on ");
+ m_result.append(currentThreadName());
+ m_result.append(".\n");
}
- const String& result()
+ String result()
{
MutexLocker locker(m_loggingMutex);
- return m_result;
+ return m_result.toString();
}
void registerThreadHolder(ThreadHolder* holder)
@@ -144,7 +152,7 @@ public:
// Protects |m_result|.
Mutex m_loggingMutex;
- String m_result;
+ StringBuilder m_result;
// Protects |m_holder|.
Mutex m_holderMutex;
@@ -216,7 +224,7 @@ public:
void resetReader() { m_reader = nullptr; }
void signalDone() { m_waitableEvent->signal(); }
- const String& result() { return m_context->result(); }
+ String result() { return m_context->result(); }
void postTaskToReadingThread(const WebTraceLocation& location, std::unique_ptr<CrossThreadClosure> task)
{
m_context->postTaskToReadingThread(location, std::move(task));

Powered by Google App Engine
This is Rietveld 408576698