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

Unified Diff: third_party/WebKit/Source/platform/text/LineEnding.cpp

Issue 2872133004: blink style: Update one class cluster, delete one class, change comment style. (Closed)
Patch Set: fun Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/platform/testing/PaintPrinters.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/text/LineEnding.cpp
diff --git a/third_party/WebKit/Source/platform/text/LineEnding.cpp b/third_party/WebKit/Source/platform/text/LineEnding.cpp
index b59713fa901c221a92eccc310f140257d253bed2..766b2f218f00ca9baccc3c1b5daf5ee654286aeb 100644
--- a/third_party/WebKit/Source/platform/text/LineEnding.cpp
+++ b/third_party/WebKit/Source/platform/text/LineEnding.cpp
@@ -36,6 +36,7 @@
#include "platform/wtf/text/CString.h"
#include "platform/wtf/text/WTFString.h"
+namespace blink {
namespace {
class OutputBuffer {
@@ -44,53 +45,53 @@ class OutputBuffer {
public:
OutputBuffer() {}
- virtual char* allocate(size_t) = 0;
- virtual void copy(const CString&) = 0;
+ virtual char* Allocate(size_t) = 0;
+ virtual void Copy(const CString&) = 0;
virtual ~OutputBuffer() {}
};
class CStringBuffer final : public OutputBuffer {
public:
- CStringBuffer(CString& buffer) : m_buffer(buffer) {}
+ CStringBuffer(CString& buffer) : buffer_(buffer) {}
~CStringBuffer() override {}
- char* allocate(size_t size) override {
+ char* Allocate(size_t size) override {
char* ptr;
- m_buffer = CString::CreateUninitialized(size, ptr);
+ buffer_ = CString::CreateUninitialized(size, ptr);
return ptr;
}
- void copy(const CString& source) override { m_buffer = source; }
+ void Copy(const CString& source) override { buffer_ = source; }
- const CString& buffer() const { return m_buffer; }
+ const CString& Buffer() const { return buffer_; }
private:
- CString m_buffer;
+ CString buffer_;
};
class VectorCharAppendBuffer final : public OutputBuffer {
public:
- VectorCharAppendBuffer(Vector<char>& buffer) : m_buffer(buffer) {}
+ VectorCharAppendBuffer(Vector<char>& buffer) : buffer_(buffer) {}
~VectorCharAppendBuffer() override {}
- char* allocate(size_t size) override {
- size_t oldSize = m_buffer.size();
- m_buffer.Grow(oldSize + size);
- return m_buffer.data() + oldSize;
+ char* Allocate(size_t size) override {
+ size_t old_size = buffer_.size();
+ buffer_.Grow(old_size + size);
+ return buffer_.data() + old_size;
}
- void copy(const CString& source) override {
- m_buffer.Append(source.data(), source.length());
+ void Copy(const CString& source) override {
+ buffer_.Append(source.data(), source.length());
}
private:
- Vector<char>& m_buffer;
+ Vector<char>& buffer_;
};
-void internalNormalizeLineEndingsToCRLF(const CString& from,
+void InternalNormalizeLineEndingsToCRLF(const CString& from,
OutputBuffer& buffer) {
// Compute the new length.
- size_t newLen = 0;
+ size_t new_len = 0;
const char* p = from.data();
while (p < from.data() + from.length()) {
char c = *p++;
@@ -98,26 +99,26 @@ void internalNormalizeLineEndingsToCRLF(const CString& from,
// Safe to look ahead because of trailing '\0'.
if (*p != '\n') {
// Turn CR into CRLF.
- newLen += 2;
+ new_len += 2;
}
} else if (c == '\n') {
// Turn LF into CRLF.
- newLen += 2;
+ new_len += 2;
} else {
// Leave other characters alone.
- newLen += 1;
+ new_len += 1;
}
}
- if (newLen < from.length())
+ if (new_len < from.length())
return;
- if (newLen == from.length()) {
- buffer.copy(from);
+ if (new_len == from.length()) {
+ buffer.Copy(from);
return;
}
p = from.data();
- char* q = buffer.allocate(newLen);
+ char* q = buffer.Allocate(new_len);
// Make a copy of the string.
while (p < from.data() + from.length()) {
@@ -140,9 +141,7 @@ void internalNormalizeLineEndingsToCRLF(const CString& from,
}
}
-} // namespace;
-
-namespace blink {
+} // namespace
void NormalizeLineEndingsToLF(const CString& from, Vector<char>& result) {
// Compute the new length.
@@ -198,14 +197,14 @@ CString NormalizeLineEndingsToCRLF(const CString& from) {
return from;
CString result;
CStringBuffer buffer(result);
- internalNormalizeLineEndingsToCRLF(from, buffer);
- return buffer.buffer();
+ InternalNormalizeLineEndingsToCRLF(from, buffer);
+ return buffer.Buffer();
}
void NormalizeLineEndingsToNative(const CString& from, Vector<char>& result) {
#if OS(WIN)
VectorCharAppendBuffer buffer(result);
- internalNormalizeLineEndingsToCRLF(from, buffer);
+ InternalNormalizeLineEndingsToCRLF(from, buffer);
#else
NormalizeLineEndingsToLF(from, result);
#endif
« no previous file with comments | « third_party/WebKit/Source/platform/testing/PaintPrinters.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698