Skip to content

Commit 4fcfa58

Browse files
committed
fix: use gc allocator for ESPostListener
Signed-off-by: Daeyeon Jeong <daeyeon.jeong@samsung.com>
1 parent 7adee2c commit 4fcfa58

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

modules/packages/device-api/src/Extension.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ ESPostListener::ESPostListener(Escargot::ContextRef* context,
212212
Escargot::ObjectRef* listener)
213213
: context_(context), listener_(listener) {
214214
DEVICEAPI_LOG_INFO("Enter");
215-
GC_add_roots(&listener_, &listener_ + sizeof(Escargot::ObjectRef*));
216215
}
217216

218217
ESPostListener::~ESPostListener() {
@@ -222,7 +221,6 @@ ESPostListener::~ESPostListener() {
222221

223222
void ESPostListener::finalize() {
224223
DEVICEAPI_LOG_INFO("Enter");
225-
GC_remove_roots(&listener_, &listener_ + sizeof(Escargot::ObjectRef*));
226224
listener_ = nullptr;
227225
context_ = nullptr;
228226
}

modules/packages/device-api/src/Extension.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
#ifndef WRT_SERVICE_NODE_EXTENSION_H_
66
#define WRT_SERVICE_NODE_EXTENSION_H_
77

8+
#include <GCUtil.h>
9+
#include <functional>
810
#include <string>
911
#include <vector>
10-
#include <functional>
1112

1213
#include "XW_Extension.h"
1314
#include "XW_Extension_SyncMessage.h"
@@ -203,12 +204,12 @@ class ESPostListener {
203204
};
204205

205206
class ESPostMessageListener : public wrt::xwalk::PostMessageListener,
206-
public ESPostListener {
207+
public ESPostListener, public gc {
207208
public:
208209
static ESPostMessageListener* create(Escargot::ContextRef* context,
209210
Escargot::ObjectRef* listener)
210211
{
211-
return new ESPostMessageListener(context, listener);
212+
return new (NoGC)ESPostMessageListener(context, listener);
212213
}
213214
void PostMessageToJS(const std::string& msg);
214215

@@ -232,12 +233,12 @@ class ESPostMessageListener : public wrt::xwalk::PostMessageListener,
232233
};
233234

234235
class ESPostDataListener : public wrt::xwalk::PostDataListener,
235-
public ESPostListener {
236+
public ESPostListener, public gc {
236237
public:
237238
static ESPostDataListener* create(Escargot::ContextRef* context,
238239
Escargot::ObjectRef* listener)
239240
{
240-
return new ESPostDataListener(context, listener);
241+
return new (NoGC)ESPostDataListener(context, listener);
241242
}
242243
void PostDataToJS(const std::string& msg, uint8_t* buffer, size_t len);
243244

0 commit comments

Comments
 (0)