Commit b4206813 authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

Move POD* containers to WTF

These are generic containers which make sense in WTF.

Bug: none
Change-Id: I7966ba923871fab7481c832eae5a16ecfa03c13c
Reviewed-on: https://chromium-review.googlesource.com/1237383Reviewed-by: default avatarYuta Kitamura <yutak@chromium.org>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594063}
parent b2c035e5
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "third_party/blink/renderer/core/html/track/text_track_cue.h" #include "third_party/blink/renderer/core/html/track/text_track_cue.h"
#include "third_party/blink/renderer/core/html/track/vtt/vtt_cue.h" #include "third_party/blink/renderer/core/html/track/vtt/vtt_cue.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/pod_interval_tree.h" #include "third_party/blink/renderer/platform/wtf/pod_interval_tree.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink { namespace blink {
...@@ -22,7 +22,7 @@ class TextTrackCueList; ...@@ -22,7 +22,7 @@ class TextTrackCueList;
// safe because CueTimeline and TextTrackCue are guaranteed to die at the same // safe because CueTimeline and TextTrackCue are guaranteed to die at the same
// time when the owner HTMLMediaElement dies. Thus the raw TextTrackCue* cannot // time when the owner HTMLMediaElement dies. Thus the raw TextTrackCue* cannot
// become stale pointers. // become stale pointers.
typedef PODIntervalTree<double, TextTrackCue*> CueIntervalTree; typedef WTF::PODIntervalTree<double, TextTrackCue*> CueIntervalTree;
typedef CueIntervalTree::IntervalType CueInterval; typedef CueIntervalTree::IntervalType CueInterval;
typedef Vector<CueInterval> CueList; typedef Vector<CueInterval> CueList;
...@@ -82,19 +82,18 @@ class TrackDisplayUpdateScope { ...@@ -82,19 +82,18 @@ class TrackDisplayUpdateScope {
Member<CueTimeline> cue_timeline_; Member<CueTimeline> cue_timeline_;
}; };
} // namespace blink
namespace WTF {
#ifndef NDEBUG #ifndef NDEBUG
// Template specializations required by PodIntervalTree in debug mode. // Template specializations required by PodIntervalTree in debug mode.
template <> template <>
struct ValueToString<double> { struct ValueToString<blink::TextTrackCue*> {
static String ToString(const double value) { return String::Number(value); } static String ToString(blink::TextTrackCue* const& cue) {
}; return cue->ToString();
}
template <>
struct ValueToString<TextTrackCue*> {
static String ToString(TextTrackCue* const& cue) { return cue->ToString(); }
}; };
#endif #endif
}
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_TRACK_CUE_TIMELINE_H_ #endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_TRACK_CUE_TIMELINE_H_
...@@ -323,7 +323,7 @@ void FloatingObjects::ClearLineBoxTreePointers() { ...@@ -323,7 +323,7 @@ void FloatingObjects::ClearLineBoxTreePointers() {
FloatingObjects::FloatingObjects(const LayoutBlockFlow* layout_object, FloatingObjects::FloatingObjects(const LayoutBlockFlow* layout_object,
bool horizontal_writing_mode) bool horizontal_writing_mode)
: placed_floats_tree_(kUninitializedTree), : placed_floats_tree_(WTF::kUninitializedTree),
left_objects_count_(0), left_objects_count_(0),
right_objects_count_(0), right_objects_count_(0),
horizontal_writing_mode_(horizontal_writing_mode), horizontal_writing_mode_(horizontal_writing_mode),
...@@ -760,14 +760,18 @@ inline bool ComputeFloatOffsetForLineLayoutAdapter< ...@@ -760,14 +760,18 @@ inline bool ComputeFloatOffsetForLineLayoutAdapter<
return false; return false;
} }
} // namespace blink
namespace WTF {
#ifndef NDEBUG #ifndef NDEBUG
// These helpers are only used by the PODIntervalTree for debugging purposes. // These helpers are only used by the PODIntervalTree for debugging purposes.
String ValueToString<LayoutUnit>::ToString(const LayoutUnit value) { String ValueToString<blink::LayoutUnit>::ToString(
const blink::LayoutUnit value) {
return String::Number(value.ToFloat()); return String::Number(value.ToFloat());
} }
String ValueToString<FloatingObject*>::ToString( String ValueToString<blink::FloatingObject*>::ToString(
const FloatingObject* floating_object) { const blink::FloatingObject* floating_object) {
return String::Format("%p (%gx%g %gx%g)", floating_object, return String::Format("%p (%gx%g %gx%g)", floating_object,
floating_object->FrameRect().X().ToFloat(), floating_object->FrameRect().X().ToFloat(),
floating_object->FrameRect().Y().ToFloat(), floating_object->FrameRect().Y().ToFloat(),
...@@ -775,5 +779,4 @@ String ValueToString<FloatingObject*>::ToString( ...@@ -775,5 +779,4 @@ String ValueToString<FloatingObject*>::ToString(
floating_object->FrameRect().MaxY().ToFloat()); floating_object->FrameRect().MaxY().ToFloat());
} }
#endif #endif
} // namespace WTF
} // namespace blink
...@@ -28,9 +28,10 @@ ...@@ -28,9 +28,10 @@
#include <memory> #include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "third_party/blink/renderer/platform/geometry/layout_rect.h" #include "third_party/blink/renderer/platform/geometry/layout_rect.h"
#include "third_party/blink/renderer/platform/pod_free_list_arena.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h"
#include "third_party/blink/renderer/platform/pod_interval_tree.h"
#include "third_party/blink/renderer/platform/wtf/list_hash_set.h" #include "third_party/blink/renderer/platform/wtf/list_hash_set.h"
#include "third_party/blink/renderer/platform/wtf/pod_free_list_arena.h"
#include "third_party/blink/renderer/platform/wtf/pod_interval_tree.h"
namespace blink { namespace blink {
...@@ -45,7 +46,7 @@ class FloatingObject { ...@@ -45,7 +46,7 @@ class FloatingObject {
#ifndef NDEBUG #ifndef NDEBUG
// Used by the PODIntervalTree for debugging the FloatingObject. // Used by the PODIntervalTree for debugging the FloatingObject.
template <class> template <class>
friend struct ValueToString; friend struct WTF::ValueToString;
#endif #endif
// Note that Type uses bits so you can use FloatLeftRight as a mask to query // Note that Type uses bits so you can use FloatLeftRight as a mask to query
...@@ -186,9 +187,10 @@ typedef ListHashSet<std::unique_ptr<FloatingObject>, ...@@ -186,9 +187,10 @@ typedef ListHashSet<std::unique_ptr<FloatingObject>,
FloatingObjectHashFunctions> FloatingObjectHashFunctions>
FloatingObjectSet; FloatingObjectSet;
typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator;
typedef PODInterval<LayoutUnit, FloatingObject*> FloatingObjectInterval; typedef WTF::PODInterval<LayoutUnit, FloatingObject*> FloatingObjectInterval;
typedef PODIntervalTree<LayoutUnit, FloatingObject*> FloatingObjectTree; typedef WTF::PODIntervalTree<LayoutUnit, FloatingObject*> FloatingObjectTree;
typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> typedef WTF::PODFreeListArena<
WTF::PODRedBlackTree<FloatingObjectInterval>::Node>
IntervalArena; IntervalArena;
typedef HashMap<LayoutBox*, std::unique_ptr<FloatingObject>> typedef HashMap<LayoutBox*, std::unique_ptr<FloatingObject>>
LayoutBoxToFloatInfoMap; LayoutBoxToFloatInfoMap;
...@@ -279,18 +281,20 @@ class FloatingObjects { ...@@ -279,18 +281,20 @@ class FloatingObjects {
DISALLOW_COPY_AND_ASSIGN(FloatingObjects); DISALLOW_COPY_AND_ASSIGN(FloatingObjects);
}; };
} // namespace blink
namespace WTF {
#ifndef NDEBUG #ifndef NDEBUG
// These structures are used by PODIntervalTree for debugging purposes. // These structures are used by PODIntervalTree for debugging purposes.
template <> template <>
struct ValueToString<LayoutUnit> { struct ValueToString<blink::LayoutUnit> {
static String ToString(const LayoutUnit value); static String ToString(const blink::LayoutUnit value);
}; };
template <> template <>
struct ValueToString<FloatingObject*> { struct ValueToString<blink::FloatingObject*> {
static String ToString(const FloatingObject*); static String ToString(const blink::FloatingObject*);
}; };
#endif #endif
} // namespace WTF
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_FLOATING_OBJECTS_H_ #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_FLOATING_OBJECTS_H_
...@@ -191,8 +191,9 @@ class CORE_EXPORT LayoutFlowThread : public LayoutBlockFlow { ...@@ -191,8 +191,9 @@ class CORE_EXPORT LayoutFlowThread : public LayoutBlockFlow {
LayoutMultiColumnSetList multi_column_set_list_; LayoutMultiColumnSetList multi_column_set_list_;
typedef PODInterval<LayoutUnit, LayoutMultiColumnSet*> MultiColumnSetInterval; typedef WTF::PODInterval<LayoutUnit, LayoutMultiColumnSet*>
typedef PODIntervalTree<LayoutUnit, LayoutMultiColumnSet*> MultiColumnSetInterval;
typedef WTF::PODIntervalTree<LayoutUnit, LayoutMultiColumnSet*>
MultiColumnSetIntervalTree; MultiColumnSetIntervalTree;
class MultiColumnSetSearchAdapter { class MultiColumnSetSearchAdapter {
...@@ -219,16 +220,18 @@ class CORE_EXPORT LayoutFlowThread : public LayoutBlockFlow { ...@@ -219,16 +220,18 @@ class CORE_EXPORT LayoutFlowThread : public LayoutBlockFlow {
DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlowThread, IsLayoutFlowThread()); DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlowThread, IsLayoutFlowThread());
} // namespace blink
namespace WTF {
// These structures are used by PODIntervalTree for debugging. // These structures are used by PODIntervalTree for debugging.
#ifndef NDEBUG #ifndef NDEBUG
template <> template <>
struct ValueToString<LayoutMultiColumnSet*> { struct ValueToString<blink::LayoutMultiColumnSet*> {
static String ToString(const LayoutMultiColumnSet* value) { static String ToString(const blink::LayoutMultiColumnSet* value) {
return String::Format("%p", value); return String::Format("%p", value);
} }
}; };
#endif #endif
} // namespace WTF
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_FLOW_THREAD_H_ #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_FLOW_THREAD_H_
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "third_party/blink/renderer/core/layout/layout_state.h" #include "third_party/blink/renderer/core/layout/layout_state.h"
#include "third_party/blink/renderer/core/scroll/scrollable_area.h" #include "third_party/blink/renderer/core/scroll/scrollable_area.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/pod_free_list_arena.h"
namespace blink { namespace blink {
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
#include "third_party/blink/renderer/core/paint/first_meaningful_paint_detector.h" #include "third_party/blink/renderer/core/paint/first_meaningful_paint_detector.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/pod_interval.h"
#include "third_party/blink/renderer/platform/supplementable.h" #include "third_party/blink/renderer/platform/supplementable.h"
#include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/timer.h"
#include "third_party/blink/renderer/platform/wtf/pod_interval.h"
namespace blink { namespace blink {
...@@ -140,8 +140,8 @@ class CORE_EXPORT InteractiveDetector ...@@ -140,8 +140,8 @@ class CORE_EXPORT InteractiveDetector
}; };
// Stores sufficiently long quiet windows on main thread and network. // Stores sufficiently long quiet windows on main thread and network.
std::vector<PODInterval<TimeTicks>> main_thread_quiet_windows_; std::vector<WTF::PODInterval<TimeTicks>> main_thread_quiet_windows_;
std::vector<PODInterval<TimeTicks>> network_quiet_windows_; std::vector<WTF::PODInterval<TimeTicks>> network_quiet_windows_;
// Start times of currently active main thread and network quiet windows. // Start times of currently active main thread and network quiet windows.
// Null TimeTicks values indicate main thread or network is not quiet at the // Null TimeTicks values indicate main thread or network is not quiet at the
......
...@@ -1228,11 +1228,6 @@ jumbo_component("platform") { ...@@ -1228,11 +1228,6 @@ jumbo_component("platform") {
"plugins/plugin_data.h", "plugins/plugin_data.h",
"plugins/plugin_script_forbidden_scope.cc", "plugins/plugin_script_forbidden_scope.cc",
"plugins/plugin_script_forbidden_scope.h", "plugins/plugin_script_forbidden_scope.h",
"pod_arena.h",
"pod_free_list_arena.h",
"pod_interval.h",
"pod_interval_tree.h",
"pod_red_black_tree.h",
"prerender.cc", "prerender.cc",
"prerender.h", "prerender.h",
"prerender_client.h", "prerender_client.h",
...@@ -1776,14 +1771,7 @@ jumbo_source_set("blink_platform_unittests_sources") { ...@@ -1776,14 +1771,7 @@ jumbo_source_set("blink_platform_unittests_sources") {
"mojo/kurl_security_origin_test.cc", "mojo/kurl_security_origin_test.cc",
"mojo/string16_mojom_traits_test.cc", "mojo/string16_mojom_traits_test.cc",
"plugins/plugin_data_test.cc", "plugins/plugin_data_test.cc",
"pod_arena_test.cc",
"pod_free_list_arena_test.cc",
"pod_interval_tree_test.cc",
"pod_red_black_tree_test.cc",
"shared_buffer_test.cc", "shared_buffer_test.cc",
"testing/arena_test_helpers.h",
"testing/tree_test_helpers.cc",
"testing/tree_test_helpers.h",
"text/bidi_resolver_test.cc", "text/bidi_resolver_test.cc",
"text/bidi_test_harness.h", "text/bidi_test_harness.h",
"text/capitalize_test.cc", "text/capitalize_test.cc",
......
...@@ -10,7 +10,6 @@ include_rules = [ ...@@ -10,7 +10,6 @@ include_rules = [
"+third_party/blink/renderer/platform/json", "+third_party/blink/renderer/platform/json",
"+third_party/blink/renderer/platform/layout_unit.h", "+third_party/blink/renderer/platform/layout_unit.h",
"+third_party/blink/renderer/platform/platform_export.h", "+third_party/blink/renderer/platform/platform_export.h",
"+third_party/blink/renderer/platform/pod_interval_tree.h",
"+third_party/blink/renderer/platform/wtf", "+third_party/blink/renderer/platform/wtf",
"+ui/gfx/geometry", "+ui/gfx/geometry",
] ]
...@@ -32,20 +32,14 @@ ...@@ -32,20 +32,14 @@
#include "third_party/blink/renderer/platform/geometry/float_point.h" #include "third_party/blink/renderer/platform/geometry/float_point.h"
#include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/geometry/float_rect.h"
#include "third_party/blink/renderer/platform/pod_interval_tree.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/pod_interval_tree.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink { namespace blink {
class FloatPolygonEdge; class FloatPolygonEdge;
// This class is used by PODIntervalTree for debugging.
#ifndef NDEBUG
template <class>
struct ValueToString;
#endif
class PLATFORM_EXPORT FloatPolygon { class PLATFORM_EXPORT FloatPolygon {
USING_FAST_MALLOC(FloatPolygon); USING_FAST_MALLOC(FloatPolygon);
WTF_MAKE_NONCOPYABLE(FloatPolygon); WTF_MAKE_NONCOPYABLE(FloatPolygon);
...@@ -68,8 +62,8 @@ class PLATFORM_EXPORT FloatPolygon { ...@@ -68,8 +62,8 @@ class PLATFORM_EXPORT FloatPolygon {
bool IsEmpty() const { return empty_; } bool IsEmpty() const { return empty_; }
private: private:
typedef PODInterval<float, FloatPolygonEdge*> EdgeInterval; typedef WTF::PODInterval<float, FloatPolygonEdge*> EdgeInterval;
typedef PODIntervalTree<float, FloatPolygonEdge*> EdgeIntervalTree; typedef WTF::PODIntervalTree<float, FloatPolygonEdge*> EdgeIntervalTree;
Vector<FloatPoint> vertices_; Vector<FloatPoint> vertices_;
FloatRect bounding_box_; FloatRect bounding_box_;
...@@ -138,25 +132,21 @@ class PLATFORM_EXPORT FloatPolygonEdge final : public VertexPair { ...@@ -138,25 +132,21 @@ class PLATFORM_EXPORT FloatPolygonEdge final : public VertexPair {
const FloatPolygon* polygon_; const FloatPolygon* polygon_;
}; };
} // namespace blink
namespace WTF {
// These structures are used by PODIntervalTree for debugging. // These structures are used by PODIntervalTree for debugging.
#ifndef NDEBUG #ifndef NDEBUG
template <> template <>
struct ValueToString<float> { struct ValueToString<blink::FloatPolygonEdge*> {
STATIC_ONLY(ValueToString); STATIC_ONLY(ValueToString);
static String ToString(const float value) { return String::Number(value); } static String ToString(const blink::FloatPolygonEdge* edge) {
};
template <>
struct ValueToString<FloatPolygonEdge*> {
STATIC_ONLY(ValueToString);
static String ToString(const FloatPolygonEdge* edge) {
return String::Format("%p (%f,%f %f,%f)", edge, edge->Vertex1().X(), return String::Format("%p (%f,%f %f,%f)", edge, edge->Vertex1().X(),
edge->Vertex1().Y(), edge->Vertex2().X(), edge->Vertex1().Y(), edge->Vertex2().X(),
edge->Vertex2().Y()); edge->Vertex2().Y());
} }
}; };
#endif #endif
} // namespace WTF
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GEOMETRY_FLOAT_POLYGON_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GEOMETRY_FLOAT_POLYGON_H_
...@@ -31,7 +31,6 @@ include_rules = [ ...@@ -31,7 +31,6 @@ include_rules = [
"+third_party/blink/renderer/platform/loader", "+third_party/blink/renderer/platform/loader",
"+third_party/blink/renderer/platform/network", "+third_party/blink/renderer/platform/network",
"+third_party/blink/renderer/platform/platform_export.h", "+third_party/blink/renderer/platform/platform_export.h",
"+third_party/blink/renderer/platform/pod_arena.h",
"+third_party/blink/renderer/platform/runtime_enabled_features.h", "+third_party/blink/renderer/platform/runtime_enabled_features.h",
"+third_party/blink/renderer/platform/scheduler", "+third_party/blink/renderer/platform/scheduler",
"+third_party/blink/renderer/platform/scroll", "+third_party/blink/renderer/platform/scroll",
......
...@@ -113,6 +113,11 @@ jumbo_component("wtf") { ...@@ -113,6 +113,11 @@ jumbo_component("wtf") {
"math_extras.h", "math_extras.h",
"noncopyable.h", "noncopyable.h",
"not_found.h", "not_found.h",
"pod_arena.h",
"pod_free_list_arena.h",
"pod_interval.h",
"pod_interval_tree.h",
"pod_red_black_tree.h",
"ref_counted.h", "ref_counted.h",
"ref_vector.h", "ref_vector.h",
"retain_ptr.h", "retain_ptr.h",
...@@ -320,6 +325,13 @@ jumbo_source_set("wtf_unittests_sources") { ...@@ -320,6 +325,13 @@ jumbo_source_set("wtf_unittests_sources") {
"hash_set_test.cc", "hash_set_test.cc",
"list_hash_set_test.cc", "list_hash_set_test.cc",
"math_extras_test.cc", "math_extras_test.cc",
"pod_arena_test.cc",
"pod_arena_test_helpers.h",
"pod_free_list_arena_test.cc",
"pod_interval_tree_test.cc",
"pod_red_black_tree_test.cc",
"pod_tree_test_helpers.cc",
"pod_tree_test_helpers.h",
"saturated_arithmetic_test.cc", "saturated_arithmetic_test.cc",
"scoped_logger_test.cc", "scoped_logger_test.cc",
"string_hasher_test.cc", "string_hasher_test.cc",
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_ARENA_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_ARENA_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_ARENA_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_ARENA_H_
#include <stdint.h> #include <stdint.h>
#include <memory> #include <memory>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "third_party/blink/renderer/platform/wtf/ref_counted.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink { namespace WTF {
// An arena which allocates only Plain Old Data (POD), or classes and // An arena which allocates only Plain Old Data (POD), or classes and
// structs bottoming out in Plain Old Data. NOTE: the constructors of // structs bottoming out in Plain Old Data. NOTE: the constructors of
...@@ -191,6 +191,6 @@ class PODArena final : public RefCounted<PODArena> { ...@@ -191,6 +191,6 @@ class PODArena final : public RefCounted<PODArena> {
Vector<std::unique_ptr<Chunk>> chunks_; Vector<std::unique_ptr<Chunk>> chunks_;
}; };
} // namespace blink } // namespace WTF
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_ARENA_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_ARENA_H_
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "third_party/blink/renderer/platform/pod_arena.h" #include "third_party/blink/renderer/platform/wtf/pod_arena.h"
#include <algorithm> #include <algorithm>
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/testing/arena_test_helpers.h" #include "third_party/blink/renderer/platform/wtf/pod_arena_test_helpers.h"
namespace blink { namespace WTF {
using ArenaTestHelpers::TrackedAllocator; using ArenaTestHelpers::TrackedAllocator;
...@@ -93,4 +93,4 @@ TEST_F(PODArenaTest, RunsConstructors) { ...@@ -93,4 +93,4 @@ TEST_F(PODArenaTest, RunsConstructors) {
} }
} }
} // namespace blink } // namespace WTF
...@@ -23,16 +23,16 @@ ...@@ -23,16 +23,16 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_ARENA_TEST_HELPERS_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_ARENA_TEST_HELPERS_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_ARENA_TEST_HELPERS_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_ARENA_TEST_HELPERS_H_
#include "third_party/blink/renderer/platform/pod_arena.h"
#include "third_party/blink/renderer/platform/wtf/not_found.h" #include "third_party/blink/renderer/platform/wtf/not_found.h"
#include "third_party/blink/renderer/platform/wtf/pod_arena.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
namespace blink { namespace WTF {
namespace ArenaTestHelpers { namespace ArenaTestHelpers {
// An allocator for the PODArena which tracks the regions which have // An allocator for the PODArena which tracks the regions which have
...@@ -66,6 +66,6 @@ class TrackedAllocator final : public PODArena::FastMallocAllocator { ...@@ -66,6 +66,6 @@ class TrackedAllocator final : public PODArena::FastMallocAllocator {
}; };
} // namespace ArenaTestHelpers } // namespace ArenaTestHelpers
} // namespace blink } // namespace WTF
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_ARENA_TEST_HELPERS_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_ARENA_TEST_HELPERS_H_
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_FREE_LIST_ARENA_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_FREE_LIST_ARENA_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_FREE_LIST_ARENA_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_FREE_LIST_ARENA_H_
#include "third_party/blink/renderer/platform/pod_arena.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/pod_arena.h"
#include "third_party/blink/renderer/platform/wtf/ref_counted.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h"
namespace blink { namespace WTF {
template <class T> template <class T>
class PODFreeListArena : public RefCounted<PODFreeListArena<T>> { class PODFreeListArena : public RefCounted<PODFreeListArena<T>> {
...@@ -123,6 +123,6 @@ class PODFreeListArena : public RefCounted<PODFreeListArena<T>> { ...@@ -123,6 +123,6 @@ class PODFreeListArena : public RefCounted<PODFreeListArena<T>> {
friend class PODFreeListArenaTest; friend class PODFreeListArenaTest;
}; };
} // namespace blink } // namespace WTF
#endif #endif
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "third_party/blink/renderer/platform/pod_free_list_arena.h" #include "third_party/blink/renderer/platform/wtf/pod_free_list_arena.h"
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/testing/arena_test_helpers.h" #include "third_party/blink/renderer/platform/wtf/pod_arena_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink { namespace WTF {
using ArenaTestHelpers::TrackedAllocator; using ArenaTestHelpers::TrackedAllocator;
...@@ -163,4 +163,4 @@ TEST_F(PODFreeListArenaTest, ReusesPreviouslyFreedObjects) { ...@@ -163,4 +163,4 @@ TEST_F(PODFreeListArenaTest, ReusesPreviouslyFreedObjects) {
} }
} }
} // namespace blink } // namespace WTF
...@@ -23,15 +23,16 @@ ...@@ -23,15 +23,16 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_INTERVAL_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_INTERVAL_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_INTERVAL_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_INTERVAL_H_
#include "third_party/blink/renderer/platform/heap/handle.h"
#ifndef NDEBUG #ifndef NDEBUG
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#endif #endif
namespace blink { #include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace WTF {
// Class representing a closed interval which can hold an arbitrary // Class representing a closed interval which can hold an arbitrary
// Plain Old Datatype (POD) as its endpoints and a piece of user // Plain Old Datatype (POD) as its endpoints and a piece of user
...@@ -71,8 +72,6 @@ namespace blink { ...@@ -71,8 +72,6 @@ namespace blink {
// Note that this class requires a copy constructor and assignment // Note that this class requires a copy constructor and assignment
// operator in order to be stored in the red-black tree. // operator in order to be stored in the red-black tree.
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#ifndef NDEBUG #ifndef NDEBUG
template <class T> template <class T>
struct ValueToString; struct ValueToString;
...@@ -143,11 +142,31 @@ class PODInterval { ...@@ -143,11 +142,31 @@ class PODInterval {
private: private:
T low_; T low_;
T high_; T high_;
GC_PLUGIN_IGNORE("crbug.com/513116") // https://crbug.com/513116.
#if defined(__clang__)
__attribute__((annotate("blink_gc_plugin_ignore"))) UserData data_;
#else
UserData data_; UserData data_;
#endif
T max_high_; T max_high_;
}; };
} // namespace blink #ifndef NDEBUG
template <>
struct ValueToString<float> {
STATIC_ONLY(ValueToString);
static String ToString(const float value) { return String::Number(value); }
};
template <>
struct ValueToString<double> {
static String ToString(const double value) { return String::Number(value); }
};
template <>
struct ValueToString<int> {
static String ToString(const int& value) { return String::Number(value); }
};
#endif
} // namespace WTF
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_INTERVAL_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_INTERVAL_H_
...@@ -23,17 +23,17 @@ ...@@ -23,17 +23,17 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_INTERVAL_TREE_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_INTERVAL_TREE_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_INTERVAL_TREE_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_INTERVAL_TREE_H_
#include "third_party/blink/renderer/platform/pod_arena.h"
#include "third_party/blink/renderer/platform/pod_interval.h"
#include "third_party/blink/renderer/platform/pod_red_black_tree.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/assertions.h"
#include "third_party/blink/renderer/platform/wtf/noncopyable.h" #include "third_party/blink/renderer/platform/wtf/noncopyable.h"
#include "third_party/blink/renderer/platform/wtf/pod_arena.h"
#include "third_party/blink/renderer/platform/wtf/pod_interval.h"
#include "third_party/blink/renderer/platform/wtf/pod_red_black_tree.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink { namespace WTF {
#ifndef NDEBUG #ifndef NDEBUG
template <class T> template <class T>
...@@ -253,6 +253,6 @@ struct ValueToString<PODInterval<T, UserData>> { ...@@ -253,6 +253,6 @@ struct ValueToString<PODInterval<T, UserData>> {
}; };
#endif #endif
} // namespace blink } // namespace WTF
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_INTERVAL_TREE_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_INTERVAL_TREE_H_
...@@ -25,15 +25,14 @@ ...@@ -25,15 +25,14 @@
// Tests for the interval tree class. // Tests for the interval tree class.
#include "third_party/blink/renderer/platform/pod_interval_tree.h" #include "third_party/blink/renderer/platform/wtf/pod_interval_tree.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/geometry/float_polygon.h" #include "third_party/blink/renderer/platform/wtf/pod_tree_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/tree_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink { namespace WTF {
using TreeTestHelpers::InitRandom; using TreeTestHelpers::InitRandom;
using TreeTestHelpers::NextRandom; using TreeTestHelpers::NextRandom;
...@@ -196,13 +195,6 @@ TEST(PODIntervalTreeTest, TestTreeDoesNotRequireMostOperators) { ...@@ -196,13 +195,6 @@ TEST(PODIntervalTreeTest, TestTreeDoesNotRequireMostOperators) {
// in release builds. // in release builds.
// #define DEBUG_INSERTION_AND_DELETION_TEST // #define DEBUG_INSERTION_AND_DELETION_TEST
#ifndef NDEBUG
template <>
struct ValueToString<int> {
static String ToString(const int& value) { return String::Number(value); }
};
#endif
namespace { namespace {
void TreeInsertionAndDeletionTest(int32_t seed, int tree_size) { void TreeInsertionAndDeletionTest(int32_t seed, int tree_size) {
...@@ -342,4 +334,4 @@ TEST(PODIntervalTreeTest, RandomDeletionAndInsertionRegressionTest4) { ...@@ -342,4 +334,4 @@ TEST(PODIntervalTreeTest, RandomDeletionAndInsertionRegressionTest4) {
ASSERT_TRUE(tree.CheckInvariants()); ASSERT_TRUE(tree.CheckInvariants());
} }
} // namespace blink } // namespace WTF
...@@ -69,21 +69,21 @@ ...@@ -69,21 +69,21 @@
// The design of this red-black tree comes from Cormen, Leiserson, // The design of this red-black tree comes from Cormen, Leiserson,
// and Rivest, _Introduction to Algorithms_, MIT Press, 1990. // and Rivest, _Introduction to Algorithms_, MIT Press, 1990.
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_RED_BLACK_TREE_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_RED_BLACK_TREE_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_RED_BLACK_TREE_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_RED_BLACK_TREE_H_
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/platform/pod_free_list_arena.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/assertions.h"
#include "third_party/blink/renderer/platform/wtf/noncopyable.h" #include "third_party/blink/renderer/platform/wtf/noncopyable.h"
#include "third_party/blink/renderer/platform/wtf/pod_free_list_arena.h"
#ifndef NDEBUG #ifndef NDEBUG
#include "third_party/blink/renderer/platform/wtf/text/cstring.h" #include "third_party/blink/renderer/platform/wtf/text/cstring.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#endif #endif
namespace blink { namespace WTF {
#ifndef NDEBUG #ifndef NDEBUG
template <class T> template <class T>
...@@ -794,6 +794,6 @@ class PODRedBlackTree { ...@@ -794,6 +794,6 @@ class PODRedBlackTree {
#endif #endif
}; };
} // namespace blink } // namespace WTF
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_POD_RED_BLACK_TREE_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_RED_BLACK_TREE_H_
...@@ -25,14 +25,14 @@ ...@@ -25,14 +25,14 @@
// Tests for the red-black tree class. // Tests for the red-black tree class.
#include "third_party/blink/renderer/platform/pod_red_black_tree.h" #include "third_party/blink/renderer/platform/wtf/pod_red_black_tree.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/testing/arena_test_helpers.h" #include "third_party/blink/renderer/platform/wtf/pod_arena_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/tree_test_helpers.h" #include "third_party/blink/renderer/platform/wtf/pod_tree_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink { namespace WTF {
using ArenaTestHelpers::TrackedAllocator; using ArenaTestHelpers::TrackedAllocator;
using TreeTestHelpers::InitRandom; using TreeTestHelpers::InitRandom;
...@@ -193,4 +193,4 @@ TEST(PODRedBlackTreeTest, RandomDeletionAndInsertionRegressionTest1) { ...@@ -193,4 +193,4 @@ TEST(PODRedBlackTreeTest, RandomDeletionAndInsertionRegressionTest1) {
InsertionAndDeletionTest(12311, 100); InsertionAndDeletionTest(12311, 100);
} }
} // namespace blink } // namespace WTF
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "third_party/blink/renderer/platform/testing/tree_test_helpers.h" #include "third_party/blink/renderer/platform/wtf/pod_tree_test_helpers.h"
#include <cstdlib> #include <cstdlib>
namespace blink { namespace WTF {
namespace TreeTestHelpers { namespace TreeTestHelpers {
void InitRandom(const int32_t seed) { void InitRandom(const int32_t seed) {
...@@ -40,4 +40,4 @@ int32_t NextRandom(const int32_t maximum_value) { ...@@ -40,4 +40,4 @@ int32_t NextRandom(const int32_t maximum_value) {
} }
} // namespace TreeTestHelpers } // namespace TreeTestHelpers
} // namespace blink } // namespace WTF
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
// //
// These are **not** thread safe! // These are **not** thread safe!
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_TREE_TEST_HELPERS_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_TREE_TEST_HELPERS_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_TREE_TEST_HELPERS_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_TREE_TEST_HELPERS_H_
#include <stdint.h> #include <stdint.h>
namespace blink { namespace WTF {
namespace TreeTestHelpers { namespace TreeTestHelpers {
// Initializes the pseudo-random number generator with a specific seed. // Initializes the pseudo-random number generator with a specific seed.
...@@ -45,6 +45,6 @@ void InitRandom(const int32_t seed); ...@@ -45,6 +45,6 @@ void InitRandom(const int32_t seed);
int32_t NextRandom(const int32_t maximum_value); int32_t NextRandom(const int32_t maximum_value);
} // namespace TreeTestHelpers } // namespace TreeTestHelpers
} // namespace blink } // namespace WTF
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_TREE_TEST_HELPERS_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_POD_TREE_TEST_HELPERS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment