Example #1
0
// Fetches a previously constructed context by name.
Context* GetContext(const String& name)
{
	ContextMap::iterator i = contexts.find(name);
	if (i == contexts.end())
		return NULL;

	return (*i).second;
}
Example #2
0
void KJavaServerMaintainer::releaseContext(QObject *w, const QString &doc)
{
    ContextMap::iterator it = m_contextmap.find(qMakePair(w, doc));
    if(it != m_contextmap.end() && --(*it).second <= 0)
    {
        kdDebug(6100) << "KJavaServerMaintainer::releaseContext" << endl;
        (*it).first->deleteLater();
        m_contextmap.remove(it);
    }
}
Example #3
0
static void retrace_glXDestroyContext(trace::Call &call) {
    ContextMap::iterator it;
    it = context_map.find(call.arg(1).toUIntPtr());
    if (it == context_map.end()) {
        return;
    }

    it->second->release();

    context_map.erase(it);
}
Example #4
0
static Context *
getContext(unsigned long long context_ptr) {
    if (context_ptr == 0) {
        return NULL;
    }

    ContextMap::const_iterator it;
    it = context_map.find(context_ptr);

    return (it != context_map.end()) ? it->second : NULL;
}
Example #5
0
static void retrace_wglDeleteContext(trace::Call &call) {
    unsigned long long hglrc = call.arg(0).toUIntPtr();

    ContextMap::iterator it;
    it = context_map.find(hglrc);
    if (it == context_map.end()) {
        return;
    }

    it->second->release();
    
    context_map.erase(it);
}
Example #6
0
KJavaAppletContext *KJavaServerMaintainer::getContext(QObject *w, const QString &doc)
{
    ContextMap::key_type key = qMakePair(w, doc);
    ContextMap::iterator it = m_contextmap.find(key);
    if(it != m_contextmap.end())
    {
        ++((*it).second);
        return (*it).first;
    }
    KJavaAppletContext *const context = new KJavaAppletContext();
    m_contextmap.insert(key, qMakePair(context, 1));
    return context;
}
Example #7
0
static glws::Context *
getContext(unsigned long long context_ptr) {
    if (context_ptr == 0) {
        return NULL;
    }

    ContextMap::const_iterator it;
    it = context_map.find(context_ptr);
    if (it == context_map.end()) {
        return (context_map[context_ptr] = ws->createContext(visual, NULL));
    }

    return it->second;
}
Example #8
0
static Context *
getContext(unsigned long long context_ptr) {
    if (context_ptr == 0) {
        return NULL;
    }

    ContextMap::const_iterator it;
    it = context_map.find(context_ptr);
    if (it == context_map.end()) {
        return (context_map[context_ptr] = glretrace::createContext());
    }

    return it->second;
}
Example #9
0
static Context *
getContext(unsigned long long context_ptr) {
    if (context_ptr == 0) {
        return NULL;
    }

    ContextMap::const_iterator it;
    it = context_map.find(context_ptr);
    if (it == context_map.end()) {
        assert(false);
        return NULL;
    }

    return it->second;
}
Example #10
0
static void retrace_eglDestroyContext(trace::Call &call) {
    unsigned long long orig_context = call.arg(1).toUIntPtr();

    ContextMap::iterator it;
    it = context_map.find(orig_context);

    if (it != context_map.end()) {
        glretrace::Context *currentContext = glretrace::getCurrentContext();
        if (it->second != currentContext) {
            // TODO: reference count
            delete it->second;
        }
        context_map.erase(it);
    }
}
Example #11
0
static void retrace_CGLDestroyContext(trace::Call &call) {
    if (call.ret->toUInt() != kCGLNoError) {
        return;
    }

    unsigned long long ctx = call.arg(0).toUIntPtr();

    ContextMap::iterator it;
    it = context_map.find(ctx);
    if (it == context_map.end()) {
        return;
    }

    delete it->second;

    context_map.erase(it);
}
Example #12
0
// Fetches a context by index.
Context* GetContext(int index)
{
	ContextMap::iterator i = contexts.begin();
	int count = 0;

	if (index >= GetNumContexts())
		index = GetNumContexts() - 1;

	while (count < index)
	{
		++i;
		++count;
	}

	if (i == contexts.end())
		return NULL;

	return (*i).second;
}
Example #13
0
static Context *
getContext(unsigned long long ctx) {
    if (ctx == 0) {
        return NULL;
    }

    ContextMap::const_iterator it;
    it = context_map.find(ctx);
    if (it == context_map.end()) {
        Context *context;
        context_map[ctx] = context = glretrace::createContext(sharedContext);
        if (!sharedContext) {
            sharedContext = context;
        }
        return context;
    }

    return it->second;
}
Example #14
0
void Shutdown()
{
	// Notify all plugins we're being shutdown.
	PluginRegistry::Instance()->NotifyShutdown();

	// Release all remaining contexts.
	for (ContextMap::iterator itr = contexts.begin(); itr != contexts.end(); ++itr)
		Core::Log::Message(Log::LT_WARNING, "Context '%s' still active on shutdown.", (*itr).first.CString());
	contexts.clear();

	TemplateCache::Shutdown();
	StyleSheetFactory::Shutdown();
	StyleSheetSpecification::Shutdown();
	FontDatabase::Shutdown();
	TextureDatabase::Shutdown();
	Factory::Instance()->Shutdown();
  Factory::DestroyInstance();

	Log::Shutdown();

  PluginRegistry::DestroyInstance();
  PropertyParserColour::DestroyInstance();
  PropCounterSingleton::DestroyInstance();

	initialised = false;

	if (render_interface != NULL)
		render_interface->RemoveReference();

	if (file_interface != NULL)
		file_interface->RemoveReference();

	if (system_interface != NULL)
		system_interface->RemoveReference();
	
	render_interface = NULL;
	file_interface = NULL;
	system_interface = NULL;
}