2013-04-25 10:25:18 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// 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:
|
|
|
|
static void BindTo(v8::Handle<v8::Object> target,
|
|
|
|
v8::Handle<v8::Value> destructor);
|
|
|
|
|
|
|
|
private:
|
|
|
|
ObjectLifeMonitor();
|
|
|
|
|
|
|
|
static void WeakCallback(v8::Isolate* isolate,
|
2013-12-11 07:48:19 +00:00
|
|
|
v8::Persistent<v8::Object>* value,
|
|
|
|
ObjectLifeMonitor* self);
|
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_
|