Commit 2b46b38f authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

BlinkMemoryMgt: Annotate webaudio classes with USING_FAST_MALLOC

The OnionSoup effort has a goal of allocating all garbage-collectible Blink objects
with Oilpan or PartitionAlloc. However, some classes of
//blink/renderer/modules/webaudio 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 ProcessorCreationParams and
SharedAudioBuffer classes, they make sense to use USING_FAST_MALLOC because they have
been used as member variables with smart pointers.

Bug: 919389
Change-Id: I415dc3360abcadff5d2b3ce25035d09d674c2720
Reviewed-on: https://chromium-review.googlesource.com/c/1488399Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#635491}
parent 5e72b6da
......@@ -28,6 +28,7 @@
#include "third_party/blink/renderer/modules/webaudio/audio_buffer.h"
#include <memory>
#include "third_party/blink/renderer/modules/webaudio/audio_buffer_options.h"
#include "third_party/blink/renderer/modules/webaudio/base_audio_context.h"
#include "third_party/blink/renderer/platform/audio/audio_bus.h"
......@@ -347,7 +348,7 @@ void AudioBuffer::Zero() {
}
std::unique_ptr<SharedAudioBuffer> AudioBuffer::CreateSharedAudioBuffer() {
return std::unique_ptr<SharedAudioBuffer>(new SharedAudioBuffer(this));
return std::make_unique<SharedAudioBuffer>(this);
}
SharedAudioBuffer::SharedAudioBuffer(AudioBuffer* buffer)
......
......@@ -34,6 +34,7 @@
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
......@@ -134,6 +135,8 @@ class MODULES_EXPORT AudioBuffer final : public ScriptWrappable {
// Shared data that audio threads can hold onto.
class SharedAudioBuffer final {
USING_FAST_MALLOC(SharedAudioBuffer);
public:
explicit SharedAudioBuffer(AudioBuffer*);
......
......@@ -12,6 +12,7 @@
#include "third_party/blink/renderer/modules/webaudio/audio_param_descriptor.h"
#include "third_party/blink/renderer/platform/audio/audio_array.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
namespace blink {
......@@ -29,6 +30,8 @@ struct GlobalScopeCreationParams;
// The storage for the construction of AudioWorkletProcessor, contains the
// processor name and MessageChannelPort object.
class MODULES_EXPORT ProcessorCreationParams final {
USING_FAST_MALLOC(ProcessorCreationParams);
public:
ProcessorCreationParams(const String& name,
MessagePortChannel message_port_channel)
......
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