Commit f4b05fb3 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

BlinkMemoryMgt: Annotate the classes of svg and testing of renderer/core with...

BlinkMemoryMgt: Annotate the classes of svg and testing of renderer/core with the macros of Allocator

The OnionSoup effort has a goal of allocating all garbage-collectable Blink objects
with Oilpan or PartitionAlloc. However, the some classes of //blink/renderer/core/svg
and //blink/renderer/core/testing have not yet been allocated with them so far.
So their uses of non-garbage-collected objects should be restricted to cases where
the garbage collector can discover their references. The macros of Allocator will be
useful for the non-garbage-collected objects to avoid unintended allocations.

After some analyzes, it was concluded that for the case of the Commands, and SimPage
classes, they make sense to use DISALLOW_NEW because they have been used as a member
variable with a reference.

In SVGPathQuery class case, they make sense to use STACK_ALLOCATED
because they have been used in function without new allocation or smart pointers.

Bug: 919389
Change-Id: I1230ae019a0ce9f6548c4d71deba5c1da4ae60f3
Reviewed-on: https://chromium-review.googlesource.com/c/1481149
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634577}
parent 8f69d9cf
......@@ -21,12 +21,16 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_SVG_SVG_PATH_QUERY_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_SVG_SVG_PATH_QUERY_H_
#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
class FloatPoint;
class SVGPathByteStream;
class SVGPathQuery {
STACK_ALLOCATED();
public:
explicit SVGPathQuery(const SVGPathByteStream&);
......
......@@ -6,6 +6,7 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_SIM_SIM_CANVAS_H_
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "third_party/skia/include/core/SkCanvas.h"
......@@ -24,6 +25,8 @@ class SimCanvas : public SkCanvas {
};
class Commands {
DISALLOW_NEW();
public:
size_t DrawCount() const { return commands_.size(); }
size_t DrawCount(CommandType, const String& color_string = String()) const;
......
......@@ -6,12 +6,15 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_SIM_SIM_PAGE_H_
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
class Page;
class SimPage final {
DISALLOW_NEW();
public:
explicit SimPage();
~SimPage();
......
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