Move all sources under atom/.
This commit is contained in:
parent
26ddbbb0ee
commit
516d46444d
217 changed files with 519 additions and 519 deletions
61
atom/common/api/atom_api_v8_util.cc
Normal file
61
atom/common/api/atom_api_v8_util.cc
Normal file
|
@ -0,0 +1,61 @@
|
|||
// 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.
|
||||
|
||||
#include "atom/common/api/object_life_monitor.h"
|
||||
|
||||
#include "atom/common/v8/native_type_conversions.h"
|
||||
#include "v8/include/v8-profiler.h"
|
||||
|
||||
#include "atom/common/v8/node_common.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace api {
|
||||
|
||||
namespace {
|
||||
|
||||
void CreateObjectWithName(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New();
|
||||
t->SetClassName(args[0]->ToString());
|
||||
args.GetReturnValue().Set(t->GetFunction()->NewInstance());
|
||||
}
|
||||
|
||||
void GetHiddenValue(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
args.GetReturnValue().Set(
|
||||
args[0]->ToObject()->GetHiddenValue(args[1]->ToString()));
|
||||
}
|
||||
|
||||
void SetHiddenValue(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
args[0]->ToObject()->SetHiddenValue(args[1]->ToString(), args[2]);
|
||||
}
|
||||
|
||||
void GetObjectHash(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
args.GetReturnValue().Set(args[0]->ToObject()->GetIdentityHash());
|
||||
}
|
||||
|
||||
void SetDestructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
ObjectLifeMonitor::BindTo(args[0]->ToObject(), args[1]);
|
||||
}
|
||||
|
||||
void TakeHeapSnapshot(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
node::node_isolate->GetHeapProfiler()->TakeHeapSnapshot(
|
||||
v8::String::New("test"));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void InitializeV8Util(v8::Handle<v8::Object> target) {
|
||||
NODE_SET_METHOD(target, "createObjectWithName", CreateObjectWithName);
|
||||
NODE_SET_METHOD(target, "getHiddenValue", GetHiddenValue);
|
||||
NODE_SET_METHOD(target, "setHiddenValue", SetHiddenValue);
|
||||
NODE_SET_METHOD(target, "getObjectHash", GetObjectHash);
|
||||
NODE_SET_METHOD(target, "setDestructor", SetDestructor);
|
||||
NODE_SET_METHOD(target, "takeHeapSnapshot", TakeHeapSnapshot);
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace atom
|
||||
|
||||
NODE_MODULE(atom_common_v8_util, atom::api::InitializeV8Util)
|
Loading…
Add table
Add a link
Reference in a new issue