Commit 8198a6ca authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

BlinkMemoryMgt: Annotate some classes of peerconnection with the macros of Allocator

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

In ByteBufferQueue and ByteBufferQueue classes case, they make sense to use
DISALLOW_NEW because they have been used as member variables with a reference type.

Lastly, the rest of the other classes make sense to use STACK_ALLOCATED because
they are used by function inside.

Bug: 919389
Change-Id: Ia428d8ec65bf5406ed1886fae3d916d7ad497b89
Reviewed-on: https://chromium-review.googlesource.com/c/1487755Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#635408}
parent 4e2f3d97
......@@ -12,6 +12,7 @@
#include "third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_adapter.h"
#include "third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_adapter_cross_thread_factory.h"
#include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/webrtc/p2p/base/p2p_transport_channel.h"
namespace rtc {
......@@ -40,6 +41,8 @@ class QuicTransportProxy;
// client should call all methods from the proxy thread and all callbacks will
// be run on the proxy thread.
class IceTransportProxy final {
USING_FAST_MALLOC(IceTransportProxy);
public:
// Delegate for receiving callbacks from the ICE implementation. These all run
// on the proxy thread.
......
......@@ -15,6 +15,7 @@
#include "third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_impl.h"
#include "third_party/blink/renderer/modules/peerconnection/adapters/test/mock_p2p_quic_stream_delegate.h"
#include "third_party/blink/renderer/modules/peerconnection/adapters/test/mock_p2p_quic_transport_delegate.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/webrtc/rtc_base/rtc_certificate.h"
#include "third_party/webrtc/rtc_base/ssl_fingerprint.h"
#include "third_party/webrtc/rtc_base/ssl_identity.h"
......@@ -43,6 +44,8 @@ const uint32_t kTransportDelegateReadBufferSize = 100 * 1024;
// .WillOnce(FireCallback(run_loop.CreateCallback()));
// run_loop.RunUntilCallbacksFired(task_runner);
class FireCallbackAction {
STACK_ALLOCATED();
public:
FireCallbackAction(base::RepeatingCallback<void()> callback)
: callback_(callback) {}
......@@ -71,6 +74,8 @@ PolymorphicAction<FireCallbackAction> FireCallback(
// case it will make more sense to use the TestCompletionCallback and the
// RunLoop for driving the test.
class CallbackRunLoop {
STACK_ALLOCATED();
public:
CallbackRunLoop(scoped_refptr<net::test::TestTaskRunner> task_runner)
: task_runner_(task_runner) {}
......@@ -234,6 +239,8 @@ class FakePacketTransport : public P2PQuicPacketTransport,
// also keeps track of when callbacks are expected on the delegate objects,
// which allows running the TestTaskRunner tasks until they have been fired.
class QuicPeerForTest {
USING_FAST_MALLOC(QuicPeerForTest);
public:
QuicPeerForTest(
std::unique_ptr<FakePacketTransport> packet_transport,
......
......@@ -14,6 +14,7 @@
#include "base/threading/thread_checker.h"
#include "third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_factory.h"
#include "third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_stats.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/webrtc/api/scoped_refptr.h"
namespace blink {
......@@ -31,6 +32,8 @@ class QuicTransportHost;
// proxy and host threads used with the QuicTransportProxy should be the same as
// the ones used with the connected IceTransportProxy.
class QuicTransportProxy final {
USING_FAST_MALLOC(QuicTransportProxy);
public:
// Delegate for receiving callbacks from the QUIC implementation. These all
// run on the proxy thread.
......
......@@ -7,6 +7,7 @@
#include "base/containers/span.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/deque.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
......@@ -16,6 +17,8 @@ namespace blink {
// Clients can append entire byte buffers then copy data out across buffer
// boundaries using |ReadInto|.
class MODULES_EXPORT ByteBufferQueue final {
DISALLOW_NEW();
public:
// Number of bytes that can be read.
wtf_size_t size() const { return size_; }
......
......@@ -9,6 +9,7 @@
#include <utility>
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
......@@ -94,6 +95,8 @@ enum class CallSetupState {
};
class MODULES_EXPORT CallSetupStateTracker {
DISALLOW_NEW();
public:
CallSetupStateTracker();
......
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