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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/ExponentialAccumulator.h

Issue 1678803002: Introduce TextAccumulator for Progressive Extraction from Text Iterators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revision on naming Created 4 years, 10 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/core/editing/VisibleUnits.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/core/editing/iterators/ExponentialAccumulator.h
diff --git a/third_party/WebKit/Source/core/editing/iterators/ExponentialAccumulator.h b/third_party/WebKit/Source/core/editing/iterators/ExponentialAccumulator.h
new file mode 100644
index 0000000000000000000000000000000000000000..800b30e05e5b24ad2d9005660a71f5f07c6f4560
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/iterators/ExponentialAccumulator.h
@@ -0,0 +1,29 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ExponentialAccumulator_h
+#define ExponentialAccumulator_h
+
+#include "core/CoreExport.h"
yosin_UTC9 2016/02/15 05:58:30 nit: Since nothing to export, we don't need to inc
+
+namespace blink {
+
+class ExponentialAccumulator {
yosin_UTC9 2016/02/15 05:58:30 |ExponentialAccumulator| does accumulate nothing.
+ STACK_ALLOCATED();
+ WTF_MAKE_NONCOPYABLE(ExponentialAccumulator);
+public:
+ ExponentialAccumulator() {}
+ int size() const { return m_size; }
+ int capacity() const { return m_capacity; }
+ void reset() { m_size = 0; }
+ void grow(int delta) { m_size += delta; m_capacity += delta; }
yosin_UTC9 2016/02/15 05:58:30 nit: enlarge() is better name? nit: Don't have two
+
+private:
+ int m_size = 0;
+ int m_capacity = 1024;
+};
+
+} // namespace blink
+
+#endif // ExponentialAccumulator_h
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698