コード例 #1
0
void WeakHandleListener<StringCache, StringImpl>::callback(v8::Isolate* isolate, v8::Persistent<v8::Value> wrapper, StringImpl* stringImpl)
{
    V8PerIsolateData::current()->stringCache()->remove(stringImpl);
    wrapper.Dispose(isolate);
    wrapper.Clear();
    stringImpl->deref();
}
コード例 #2
0
static void WeakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter)
{
    InjectedScriptHost* nativeObject = static_cast<InjectedScriptHost*>(parameter);
    nativeObject->deref();
    object.Dispose();
    object.Clear();
}
コード例 #3
0
static void cachedStringCallback(v8::Persistent<v8::Value> wrapper, void* parameter)
{
    StringImpl* stringImpl = static_cast<StringImpl*>(parameter);
    V8PerIsolateData::current()->stringCache()->remove(stringImpl);
    wrapper.Dispose();
    stringImpl->deref();
}
コード例 #4
0
ファイル: Class.hpp プロジェクト: OrenMe/vu8
 static inline void MadeWeak(v8::Persistent<v8::Value> object,
                             void                     *parameter)
 {
     T *obj = static_cast<T *>(parameter);
     delete(obj);
     object.Dispose();
     object.Clear();
 }
コード例 #5
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
void
JSFeatureProfile::FreeProfileCallback(v8::Persistent<v8::Value> object, void *parameter)
{
    FeatureProfile* profile = static_cast<FeatureProfile*>(parameter);
    delete profile;

    object.Dispose();
    object.Clear();
}
コード例 #6
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
void
JSVec3d::FreeVecCallback(v8::Persistent<v8::Value> object, void *parameter)
{
    osg::Vec3d* v = static_cast<osg::Vec3d*>(parameter);
    delete v;

    object.Dispose();
    object.Clear();
}
コード例 #7
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
void
JSBounds::FreeBoundsCallback(v8::Persistent<v8::Value> object, void *parameter)
{
    Bounds* bounds = static_cast<Bounds*>(parameter);
    delete bounds;

    object.Dispose();
    object.Clear();
}
コード例 #8
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
void
JSSymbologyGeometry::FreeGeometryCallback(v8::Persistent<v8::Value> object, void *parameter)
{
    osgEarth::Symbology::Geometry* geometry = static_cast<osgEarth::Symbology::Geometry*>(parameter);
    delete geometry;

    object.Dispose();
    object.Clear();
}
コード例 #9
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
void
JSFeature::FreeFeatureCallback(v8::Persistent<v8::Value> object, void *parameter)
{
    Feature* feature = static_cast<Feature*>(parameter);
    delete feature;

    object.Dispose();
    object.Clear();
}
コード例 #10
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
void
JSGeoExtent::FreeGeoExtentCallback(v8::Persistent<v8::Value> object, void *parameter)
{
    osgEarth::GeoExtent* extent = static_cast<osgEarth::GeoExtent*>(parameter);
    delete extent;

    object.Dispose();
    object.Clear();
}
コード例 #11
0
void SimpleDecWrappedRefCount(Isolate* isolate, v8::Persistent<v8::Value> object, void *parameter){
	SMJS_BaseWrapped *wrapped = (SMJS_BaseWrapped*) parameter;
	if(--wrapped->refCount == 0){
		delete wrapped;
	}

	object.Dispose();
    object.Clear();
}
コード例 #12
0
static void cachedStringCallback(v8::Persistent<v8::Value> wrapper, void* parameter)
{
    ASSERT(WTF::isMainThread());
    StringImpl* stringImpl = static_cast<StringImpl*>(parameter);
    ASSERT(getStringCache().contains(stringImpl));
    getStringCache().remove(stringImpl);
    wrapper.Dispose();
    stringImpl->deref();
}
コード例 #13
0
void clrFuncProxyNearDeath(v8::Persistent<v8::Value> object, void* parameters)
{
    DBG("clrFuncProxyNearDeath");
    ClrFuncWrap* wrap = (ClrFuncWrap*)parameters;
    object.Dispose();
    object.Clear();
    wrap->clrFunc = nullptr;
    delete wrap;
}
コード例 #14
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
void
JSMapInfo::FreeMapInfoCallback(v8::Persistent<v8::Value> object, void *parameter)
{
    Session* session = static_cast<Session*>(parameter);
    delete session;

    object.Dispose();
    object.Clear();
}
コード例 #15
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
void
JSFilterContext::FreeContextCallback(v8::Persistent<v8::Value> object, void *parameter)
{
    FilterContext* context = static_cast<FilterContext*>(parameter);
    delete context;

    object.Dispose();
    object.Clear();
}
コード例 #16
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
void
JSSpatialReference::FreeSpatialReferenceCallback(v8::Persistent<v8::Value> object, void *parameter)
{
    //osgEarth::SpatialReference* srs = static_cast<osgEarth::SpatialReference*>(parameter);
    //delete srs;
    osg::ref_ptr<osgEarth::SpatialReference> srs = static_cast<osgEarth::SpatialReference*>(parameter);

    object.Dispose();
    object.Clear();
}
コード例 #17
0
ファイル: decode.hpp プロジェクト: nvdnkpr/tilelive-s3
    ~DecodeBaton() {
        (*image).buffer.Dispose();

#if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION <= 4
        ev_unref(EV_DEFAULT_UC);
#endif
        // Note: The result buffer is freed by the node Buffer's free callback

        callback.Dispose();
    }
コード例 #18
0
ファイル: blend.hpp プロジェクト: Open-Source-GIS/node-blend
    ~BlendBaton() {
        for (Images::iterator cur = images.begin(); cur != images.end(); cur++) {
            (*cur)->buffer.Dispose();
        }

#if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION <= 4
        ev_unref(EV_DEFAULT_UC);
#endif
        // Note: The result buffer is freed by the node Buffer's free callback

        callback.Dispose();
    }
コード例 #19
0
ファイル: obj_cache.hpp プロジェクト: diorahman/node-gdal
void ObjectCache<K>::WeakCallback(v8::Persistent<v8::Value> object, void *parameter) {
  //called when only reference to object is weak - after garbage collection
  CallbackParameters<K> *params = (CallbackParameters<K>*) parameter;

  //remove it from the map
  params->cache->erase(params->key);

  //clear the reference to it
  object.Dispose();
  object.Clear();

  free(params);
}
コード例 #20
0
ファイル: ofxNodejs.cpp プロジェクト: prettyextreme/ofxNodejs
		void onExit(ofEventArgs&)
		{
			{
				v8::HandleScope handle_scope;
				node::EmitExit(process_l);
				node::RunAtExit();
			}
			
			context.Dispose();
			
			delete context_scope;
			context_scope = NULL;
			
			v8::V8::Dispose();
		}
コード例 #21
0
ファイル: main.cpp プロジェクト: renbing/Canvas
void Java_com_woyouquan_Canvas_nativeDone( JNIEnv *env )
{
	zip_close(apkArchive);

	if( !jsMainLoop.IsEmpty() )
	{
		jsMainLoop.Dispose();
	}

	CTimer::getInstance()->clean();
	CV8Context::getInstance()->clean();

	curl_global_cleanup();

	LOG("canvas done");
}
コード例 #22
0
ファイル: osmjs.cpp プロジェクト: hholzgra/osmium
int main(int argc, char *argv[]) {
    bool two_passes = false;
    bool attempt_repair = true;
    std::string javascript_filename;
    std::string osm_filename;
    std::vector<std::string> include_files;
    enum location_store_t {
        NONE,
        ARRAY,
        DISK,
        SPARSETABLE
    } location_store = NONE;

    static struct option long_options[] = {
        {"debug",                no_argument, 0, 'd'},
        {"include",        required_argument, 0, 'i'},
        {"javascript",     required_argument, 0, 'j'},
        {"help",                 no_argument, 0, 'h'},
        {"location-store", required_argument, 0, 'l'},
        {"no-repair",            no_argument, 0, 'r'},
        {"2pass",                no_argument, 0, '2'},
        {0, 0, 0, 0}
    };

    bool debug = false;

    while (1) {
        int c = getopt_long(argc, argv, "dhi:j:l:r2", long_options, 0);
        if (c == -1)
            break;

        switch (c) {
            case 'd':
                debug = true;
                break;
            case 'i': {
                std::string f(optarg);
                include_files.push_back(find_include_file(f));
                break;
            }
            case 'j':
                javascript_filename = optarg;
                break;
            case 'h':
                print_help();
                exit(0);
            case 'l':
                if (!strcmp(optarg, "none")) {
                    location_store = NONE;
                } else if (!strcmp(optarg, "array")) {
                    location_store = ARRAY;
                } else if (!strcmp(optarg, "disk")) {
                    location_store = DISK;
                } else if (!strcmp(optarg, "sparsetable")) {
                    location_store = SPARSETABLE;
                } else {
                    std::cerr << "Unknown location store: " << optarg << " (available are: 'none, 'array', 'disk' and 'sparsetable')" << std::endl;
                    exit(1);
                }
                break;
            case 'r':
                attempt_repair = false;
                break;
            case '2':
                two_passes = true;
                break;
            default:
                exit(1);
        }
    }

    if (javascript_filename.empty()) {
        std::cerr << "No --javascript/-j option given" << std::endl;
        exit(1);
    }

    if (optind >= argc) {
        std::cerr << "Usage: " << argv[0] << " [OPTIONS] OSMFILE [SCRIPT_ARG ...]" << std::endl;
        exit(1);
    } else {
        osm_filename = argv[optind];
    }

    if (two_passes && osm_filename == "-") {
        std::cerr << "Can't read from stdin when in dual-pass mode" << std::endl;
        exit(1);
    }

    Osmium::Framework osmium(debug);
    Osmium::OSMFile infile(osm_filename);

    v8::HandleScope handle_scope;

    v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
    global_template->Set(v8::String::New("print"), v8::FunctionTemplate::New(Osmium::Handler::Javascript::Print));
    global_template->Set(v8::String::New("include"), v8::FunctionTemplate::New(Osmium::Handler::Javascript::Include));

    global_context = v8::Persistent<v8::Context>::New(v8::Context::New(0, global_template));
    v8::Context::Scope context_scope(global_context);

    // put rest of the arguments into Javascript argv array
    v8::Handle<v8::Array> js_argv = v8::Array::New(argc-optind-1);
    for (int i=optind+1; i<argc; ++i) {
        v8::Local<v8::Integer> ii = v8::Integer::New(i-(optind+1));
        v8::Local<v8::String> s = v8::String::New(argv[i]);
        js_argv->Set(ii, s);
    }
    global_context->Global()->Set(v8::String::New("argv"), js_argv);

    Osmium::Javascript::Template::init();

    Osmium::Handler::NodeLocationStore *handler_node_location_store;
    if (location_store == ARRAY) {
        handler_node_location_store = new Osmium::Handler::NLS_Array();
    } else if (location_store == DISK) {
        handler_node_location_store = new Osmium::Handler::NLS_Disk();
    } else if (location_store == SPARSETABLE) {
        handler_node_location_store = new Osmium::Handler::NLS_Sparsetable();
    } else {
        handler_node_location_store = NULL;
    }
    handler_javascript = new Osmium::Handler::Javascript(include_files, javascript_filename.c_str());

    if (two_passes) {
        Osmium::Handler::Multipolygon *handler_multipolygon = new Osmium::Handler::Multipolygon(attempt_repair, cbmp);
        infile.read<DualPass1>(new DualPass1(handler_node_location_store, handler_multipolygon, handler_javascript));
        infile.read<DualPass2>(new DualPass2(handler_node_location_store, handler_multipolygon, handler_javascript));
        delete handler_multipolygon;
    } else {
        infile.read<SinglePass>(new SinglePass(handler_node_location_store, handler_javascript));
    }
    delete handler_javascript;
    delete handler_node_location_store;

    global_context.Dispose();
}
コード例 #23
0
	~JSContext(){
		context.Dispose();
	}
コード例 #24
0
ファイル: template.hpp プロジェクト: AMDmi3/osmium
 static void free_instance(v8::Persistent<v8::Value> instance, void* obj) {
     instance.Dispose();
     delete static_cast<TWrapped*>(obj);
 }
コード例 #25
0
ファイル: template.hpp プロジェクト: AMDmi3/osmium
 ~Template() {
     js_template.Dispose();
 }
コード例 #26
0
void WeakHandleListener<InjectedScriptManager, InjectedScriptHost>::callback(v8::Isolate* isolate, v8::Persistent<v8::Value> object, InjectedScriptHost* host)
{
    host->deref();
    object.Dispose(isolate);
    object.Clear();
}
コード例 #27
0
ファイル: object.hpp プロジェクト: MaZderMind/osmium
            virtual ~Object() {
#ifdef OSMIUM_WITH_JAVASCRIPT
                js_object_instance.Dispose();
#endif // OSMIUM_WITH_JAVASCRIPT
            }
コード例 #28
0
		~NodeCallback() {
			Holder.Dispose();
			cb.Dispose();
		}
コード例 #29
0
ファイル: DOMWrapperWorld.cpp プロジェクト: fmalita/webkit
void WeakHandleListener<DOMWrapperWorld>::callback(v8::Isolate* isolate, v8::Persistent<v8::Value> object, DOMWrapperWorld* world)
{
    object.Dispose(isolate);
    object.Clear();
    world->deref();
}
コード例 #30
0
static void make_weak_callback(v8::Persistent<v8::Value> object, void *parameter) {
	object.Dispose(); // if there is no reference from js, surelly this can be disposed.
	object.Clear();
}