Commit 4e2f3d97 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

BlinkMemoryMgt: Annonate some classes of ServiceWorker 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/modules/service_worker 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 RawScriptData class,
it makes sense to use USING_FAST_MALLOC because it has been used with smart pointers.

In Receiver class case, it makes sense to use DISALLOW_NEW because it has been used
as a member variable with a reference type.

Additionally this CL annonates HTMLMediaElementRemotePlayback with STAIC_ONLY.

Bug: 919389
Change-Id: I084e8207dfb51170bba4a5255e0ecc3ef262d599
Reviewed-on: https://chromium-review.googlesource.com/c/1487759Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#635407}
parent 49d9546d
......@@ -9,6 +9,7 @@
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/supplementable.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
......@@ -19,6 +20,8 @@ class RemotePlayback;
// Collection of static methods only used for bindings in the context of the
// Remote Playback API.
class MODULES_EXPORT HTMLMediaElementRemotePlayback final {
STATIC_ONLY(HTMLMediaElementRemotePlayback);
public:
static bool FastHasAttribute(const QualifiedName&, const HTMLMediaElement&);
static void SetBooleanAttribute(const QualifiedName&,
......
......@@ -13,6 +13,7 @@
#include "third_party/blink/renderer/core/html/parser/text_resource_decoder.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_thread.h"
#include "third_party/blink/renderer/platform/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
......@@ -30,6 +31,8 @@ namespace {
// BundledReceivers. It is created to read the script body or metadata from a
// data pipe, and is destroyed when the read finishes.
class Receiver {
DISALLOW_NEW();
public:
using BytesChunk = Vector<char>;
......
......@@ -44,6 +44,8 @@ class MODULES_EXPORT ThreadSafeScriptContainer
// Container of a script. All the fields of this class need to be
// cross-thread-transfer-safe.
class MODULES_EXPORT RawScriptData {
USING_FAST_MALLOC(RawScriptData);
public:
static std::unique_ptr<RawScriptData> Create(const String& encoding,
Vector<BytesChunk> script_text,
......
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