2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-04-25 10:25:18 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef ATOM_COMMON_API_OBJECT_LIFE_MONITOR_H_
|
|
|
|
#define ATOM_COMMON_API_OBJECT_LIFE_MONITOR_H_
|
|
|
|
|
2014-03-16 01:37:04 +00:00
|
|
|
#include "base/basictypes.h"
|
2014-04-22 15:07:21 +00:00
|
|
|
#include "native_mate/scoped_persistent.h"
|
2013-04-25 10:25:18 +00:00
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
class ObjectLifeMonitor {
|
|
|
|
public:
|
2014-06-28 14:33:00 +00:00
|
|
|
static void BindTo(v8::Isolate* isolate,
|
2015-05-22 11:11:22 +00:00
|
|
|
v8::Local<v8::Object> target,
|
|
|
|
v8::Local<v8::Value> destructor);
|
2013-04-25 10:25:18 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
ObjectLifeMonitor();
|
|
|
|
|
2014-06-28 14:33:00 +00:00
|
|
|
static void WeakCallback(
|
|
|
|
const v8::WeakCallbackData<v8::Object, ObjectLifeMonitor>& data);
|
2013-04-25 10:25:18 +00:00
|
|
|
|
2014-04-22 15:07:21 +00:00
|
|
|
mate::ScopedPersistent<v8::Object> handle_;
|
2013-04-25 10:25:18 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ObjectLifeMonitor);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
|
|
|
#endif // ATOM_COMMON_API_OBJECT_LIFE_MONITOR_H_
|