コード例 #1
0
void MainResourceLoader::continueAfterNavigationPolicy(const ResourceRequest& request, bool shouldContinue)
{
    if (!shouldContinue)
        stopLoadingForPolicyChange();
    else if (m_substituteData.isValid()) {
        // A redirect resulted in loading substitute data.
        ASSERT(documentLoader()->timing()->redirectCount());
        clearResource();
        handleSubstituteDataLoadSoon(request);
    }

    deref(); // balances ref in willSendRequest
}
コード例 #2
0
ファイル: arm_print.c プロジェクト: glycerine/low-level-lush
void
sprint_ivector(LispObj o)
{
  LispObj header = header_of(o);
  unsigned 
    elements = header_element_count(header),
    subtag = header_subtag(header);
    
  switch(subtag) {
  case subtag_simple_base_string:
    add_char('"');
    add_lisp_base_string(o);
    add_char('"');
    return;
    
  case subtag_bignum:
    if (elements == 1) {
      sprint_signed_decimal((signed_natural)(deref(o, 1)));
      return;
    }
    if ((elements == 2) && (deref(o, 2) == 0)) {
      sprint_unsigned_decimal(deref(o, 1));
      return;
    }
    break;
    
  case subtag_double_float:
    break;

  case subtag_macptr:
    add_c_string("#<MACPTR ");
    sprint_unsigned_hex(deref(o,1));
    add_c_string(">");
    break;

  default:
    sprint_random_vector(o, subtag, elements);
  }
}
コード例 #3
0
ファイル: QualifiedName.cpp プロジェクト: GRGSIBERIA/EAWebKit
void QualifiedName::externalDeref()
{
	if(m_impl) 
	{	
		m_impl->m_prefix.externalDeref();
		m_impl->m_localName.externalDeref();
		m_impl->m_namespace.externalDeref();
	}
	//m_impl->deref();
	//m_impl = NULL;
	deref();
	m_impl=NULL;
}
コード例 #4
0
// private methods
void SocketStreamHandle::processMessageOnMainThread(StreamMessage msg)
{
    switch (msg) {
        case DidOpen:
            ASSERT(m_state == Open);
            if (m_client)
                m_client->didOpenSocketStream(this);
            break;
        case DidFail:
            ASSERT(m_curl_code != CURLE_OK);
            LOG_CONNECT(Network, "SocketStreamHandleCurl: DidFail, error %d (%s), curl error buffer: %s [%p][thread=%d]\n", m_curl_code, curl_easy_strerror(m_curl_code), m_curl_error_buffer, this, GetCurrentThreadId());
            if (m_client)
                m_client->didFailSocketStream(this, SocketStreamError(m_curl_code, m_url.isEmpty() ? String() : m_url.string()));
            break;
        case DidReceiveData:
            didReceiveData();
            break;
        case DidSelectForWrite: {
            deref(); // this balances the ref() when spinning up the send wait thread.
            // LOG(Network, "SocketStreamHandleCurl: DidSelectForWrite [%p][thread=%d]\n", this, GetCurrentThreadId());
            if (!m_platformCloseRequested) {
                if (m_curl_code == CURLE_OK) {
                    sendPendingData();
                }
                else if (m_client) {
                    m_client->didFailSocketStream(this, SocketStreamError(m_curl_code, m_url.isEmpty() ? String() : m_url.string()));
                }
            }
            } break;
        case DidClose:
            disconnect();
            break;
        case DidStopRecvLoop:
            deref(); // this balances the ref() in the constructor.
            break;
    }
    deref();
}
コード例 #5
0
ファイル: reader.c プロジェクト: anukat2015/serd
static bool
read_base(SerdReader* reader)
{
	// `@' is already eaten in read_directive
	eat_string(reader, "base", 4);
	TRY_RET(read_ws_plus(reader));
	Ref uri;
	TRY_RET(uri = read_IRIREF(reader));
	if (reader->base_sink) {
		reader->base_sink(reader->handle, deref(reader, uri));
	}
	pop_node(reader, uri);
	return true;
}
コード例 #6
0
void OfflineAudioDestinationNode::offlineRender()
{
    ASSERT(!isMainThread());
    ASSERT(m_renderBus.get());
    if (!m_renderBus.get())
        return;

    bool isAudioContextInitialized = context().isInitialized();
    ASSERT(isAudioContextInitialized);
    if (!isAudioContextInitialized)
        return;

    bool channelsMatch = m_renderBus->numberOfChannels() == m_renderTarget->numberOfChannels();
    ASSERT(channelsMatch);
    if (!channelsMatch)
        return;
        
    bool isRenderBusAllocated = m_renderBus->length() >= renderQuantumSize;
    ASSERT(isRenderBusAllocated);
    if (!isRenderBusAllocated)
        return;
        
    // Break up the render target into smaller "render quantize" sized pieces.
    // Render until we're finished.
    size_t framesToProcess = m_renderTarget->length();
    unsigned numberOfChannels = m_renderTarget->numberOfChannels();

    unsigned n = 0;
    while (framesToProcess > 0) {
        // Render one render quantum.
        render(0, m_renderBus.get(), renderQuantumSize);
        
        size_t framesAvailableToCopy = std::min(framesToProcess, renderQuantumSize);
        
        for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) {
            const float* source = m_renderBus->channel(channelIndex)->data();
            float* destination = m_renderTarget->getChannelData(channelIndex)->data();
            memcpy(destination + n, source, sizeof(float) * framesAvailableToCopy);
        }
        
        n += framesAvailableToCopy;
        framesToProcess -= framesAvailableToCopy;
    }
    
    // Our work is done. Let the AudioContext know.
    callOnMainThread([this] {
        notifyComplete();
        deref();
    });
}
コード例 #7
0
ファイル: heap.c プロジェクト: AidanDelaney/adaptagrams
void PQdelete(Halfedge * he)
{
    Halfedge *last;

    if (he->vertex != (Site *) NULL) {
	last = &PQhash[PQbucket(he)];
	while (last->PQnext != he)
	    last = last->PQnext;
	last->PQnext = he->PQnext;
	PQcount -= 1;
	deref(he->vertex);
	he->vertex = (Site *) NULL;
    }
}
コード例 #8
0
ファイル: statement.cpp プロジェクト: rovshan-b/oraexp
Statement::~Statement()
{
    inDestructor=true;
    cleanup();

    if(acquiredMutex){
        qDebug("COULD DELETE Statement WITH MUTEX ACQUIRED. THIS IS A BUG.");
        connection->unlock();
    }

    //qDebug("deleted statement");

    deref();
}
コード例 #9
0
ファイル: deltabtor.c プロジェクト: 0x00f/cloud9-boolector
static int
isallone (int start)
{
  const char * p;
  Exp * e;

  start = deref (start);

  if (start < 0)
    {
      e = exps - start;
      if (!strcmp (e->op, "zero"))
	return 1;

      if (!e->name)
	return 0;

      if (!strcmp (e->op, "const") || 
	  !strcmp (e->op, "consth") ||
	  !strcmp (e->op, "constx"))
	{
	  for (p = e->name; *p; p++)
	    if (*p != '0')
	      return 0;

	  return 1;
	}
    }
  else
    {
      e = exps + start;

      if (!e->name)
	return 0;

      if (!strcmp (e->op, "const") ||
	  (e->width == 1 &&
	   (!strcmp (e->op, "consth") || !strcmp (e->op, "constx"))))
	{
	  for (p = e->name; *p; p++)
	    if (*p != '1')
	      return 0;

	  return 1;
	}
    }

  return 0;
}
コード例 #10
0
void ResourceHandle::fileLoadTimer(Timer<ResourceHandle>*)
{
    RefPtr<ResourceHandle> protector(this);
    deref(); // balances ref in start

    if (firstRequest().url().protocolIsData()) {
        handleDataURL(this);
        return;
    }

    String fileName = firstRequest().url().fileSystemPath();
    HANDLE fileHandle = CreateFileW(fileName.charactersWithNullTermination(), GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);

    if (fileHandle == INVALID_HANDLE_VALUE) {
        client()->didFail(this, ResourceError());
        return;
    }

    ResourceResponse response;

    int dotPos = fileName.reverseFind('.');
    int slashPos = fileName.reverseFind('/');

    if (slashPos < dotPos && dotPos != -1) {
        String ext = fileName.substring(dotPos + 1);
        response.setMimeType(MIMETypeRegistry::getMIMETypeForExtension(ext));
    }

    client()->didReceiveResponse(this, response);

    bool result = false;
    DWORD bytesRead = 0;

    do {
        const int bufferSize = 8192;
        char buffer[bufferSize];
        result = ReadFile(fileHandle, &buffer, bufferSize, &bytesRead, 0);
        // FIXME: https://bugs.webkit.org/show_bug.cgi?id=19793
        // -1 means we do not provide any data about transfer size to inspector so it would use
        // Content-Length headers or content size to show transfer size.
        if (result && bytesRead)
            client()->didReceiveData(this, buffer, bytesRead, -1);
        // Check for end of file.
    } while (result && bytesRead);

    CloseHandle(fileHandle);

    client()->didFinishLoading(this, 0);
}
コード例 #11
0
ファイル: memory.cpp プロジェクト: jsbluethree/emily
	void MemoryManager::free(Value val){
		switch (val.type){
		case ValType::String: strings.free(val); break;
		case ValType::BuiltinFunction: builtinFuns.free(val); break;
		case ValType::UserClosure: userClosures.free(val); break;
		case ValType::BuiltinClosure: builtinClosures.free(val); break;
		case ValType::Continuation: continuations.free(val); break;
		case ValType::Table:
			for (auto pair : get<Table>(val)){
				deref(pair.second);
			}
			tables.free(val);
		default: return;
		}
	}
コード例 #12
0
FILE *open_file(NODE *arg, char *access)
{
    char *fnstr;
    FILE *tstrm;

    ref(arg);
    arg = reref(arg, cnv_node_to_strnode(arg));
    if (arg == UNBOUND) return(NULL);
    fnstr = (char *) malloc((size_t)getstrlen(arg) + 1);
    strnzcpy(fnstr, getstrptr(arg), getstrlen(arg));
    tstrm = fopen(fnstr, access);
    deref(arg);
    free(fnstr);
    return(tstrm);
}
コード例 #13
0
ファイル: s_fragprog_to_c.c プロジェクト: Ionic/nx-libs
/* This is where the handling of expressions breaks down into string
 * processing:
 */
static void print_expression( struct fragment_program *p,
			      GLuint i,
			      const char *fmt,
			      va_list ap )
{
   while (*fmt) {
      if (*fmt == '%' && *(fmt+1) == 's') {
	 int reg = va_arg(ap, int);

	 /* Use of deref() is a bit of a hack:
	  */
	 print_arg( p, deref(reg, i) );
	 fmt += 2;
      }
      else { 
コード例 #14
0
ファイル: mem_test5.c プロジェクト: yuehan21ql/ArchLab2015
void check(unsigned int mem, unsigned int expected_val) {
    if(mem == expected_val) {
        putc('Y', vga);
        put_hex(mem, vga + 2);
        put_hex(expected_val, vga + 14);
        vga += screen_width/4;
    }
    else {
        deref(0xddd00000) = 0;
        putc('N', vga);
        put_hex(mem, vga + 2);
        put_hex(expected_val, vga + 14);
        vga += screen_width/4;
    }
}
コード例 #15
0
void PluginView::unprotectPluginFromDestruction()
{
    if (m_isBeingDestroyed)
        return;

    // A plug-in may ask us to evaluate JavaScript that removes the plug-in from the
    // page, but expect the object to still be alive when the call completes. Flash,
    // for example, may crash if the plug-in is destroyed and we return to code for
    // the destroyed object higher on the stack. To prevent this, if the plug-in has
    // only one remaining reference, call deref() asynchronously.
    if (hasOneRef())
        RunLoop::main()->dispatch(bind(derefPluginView, this));
    else
        deref();
}
コード例 #16
0
ファイル: reader.c プロジェクト: anukat2015/serd
static Ref
pop_node(SerdReader* reader, Ref ref)
{
	if (ref && ref != reader->rdf_first && ref != reader->rdf_rest
	    && ref != reader->rdf_nil) {
#ifdef SERD_STACK_CHECK
		SERD_STACK_ASSERT_TOP(reader, ref);
		--reader->n_allocs;
#endif
		SerdNode* const node = deref(reader, ref);
		uint8_t* const  top  = reader->stack.buf + reader->stack.size;
		serd_stack_pop(&reader->stack, top - (uint8_t*)node);
	}
	return 0;
}
コード例 #17
0
void LayoutPart::destroy()
{
    willBeDestroyed();
    // We call clearNode here because LayoutPart is ref counted. This call to destroy
    // may not actually destroy the layout object. We can keep it around because of
    // references from the FrameView class. (The actual destruction of the class happens
    // in postDestroy() which is called from deref()).
    //
    // But, we've told the system we've destroyed the layoutObject, which happens when
    // the DOM node is destroyed. So there is a good change the DOM node this object
    // points too is invalid, so we have to clear the node so we make sure we don't
    // access it in the future.
    clearNode();
    deref();
}
コード例 #18
0
void V8AbstractEventListener::clearListenerObject()
{
    if (!hasExistingListenerObject())
        return;
    m_listener.clear();
    if (m_workerGlobalScope) {
        m_workerGlobalScope->deregisterEventListener(this);
    } else {
#if ENABLE(OILPAN)
        m_keepAlive.clear();
#else
        deref();
#endif
    }
}
コード例 #19
0
ファイル: ScriptStreamer.cpp プロジェクト: RobinWuDev/Qt
void ScriptStreamer::streamingComplete()
{
    // The background task is completed; do the necessary ramp-down in the main
    // thread.
    ASSERT(isMainThread());

    // It's possible that the corresponding Resource was deleted before V8
    // finished streaming. In that case, the data or the notification is not
    // needed. In addition, if the streaming is suppressed, the non-streaming
    // code path will resume after the resource has loaded, before the
    // background task finishes.
    if (m_detached || m_streamingSuppressed) {
        deref();
        return;
    }

    // We have now streamed the whole script to V8 and it has parsed the
    // script. We're ready for the next step: compiling and executing the
    // script.
    notifyFinishedToClient();

    // The background thread no longer holds an implicit reference.
    deref();
}
コード例 #20
0
ファイル: ScriptStreamer.cpp プロジェクト: RobinWuDev/Qt
void ScriptStreamer::notifyFinished(Resource* resource)
{
    ASSERT(isMainThread());
    ASSERT(m_resource == resource);
    // A special case: empty and small scripts. We didn't receive enough data to
    // start the streaming before this notification. In that case, there won't
    // be a "parsing complete" notification either, and we should not wait for
    // it.
    if (!m_haveEnoughDataForStreaming) {
        const char* histogramName = startedStreamingHistogramName(m_scriptType);
        blink::Platform::current()->histogramEnumeration(histogramName, 0, 2);
        suppressStreaming();
    }
    if (m_stream)
        m_stream->didFinishLoading();
    m_loadingFinished = true;

    if (shouldBlockMainThread()) {
        // Make the main thead wait until the streaming is complete, to make
        // sure that the script gets the main thread's attention as early as
        // possible (for possible compiling, if the client wants to do it
        // right away). Note that blocking here is not any worse than the
        // non-streaming code path where the main thread eventually blocks
        // to parse the script.
        TRACE_EVENT0("v8", "v8.mainThreadWaitingForParserThread");
        MutexLocker locker(m_mutex);
        while (!isFinished()) {
            ASSERT(!m_parsingFinished);
            ASSERT(!m_streamingSuppressed);
            m_mainThreadWaitingForParserThread = true;
            m_parsingFinishedCondition.wait(m_mutex);
        }
    }

    // Calling notifyFinishedToClient can result into the upper layers dropping
    // references to ScriptStreamer. Keep it alive until this function ends.
    RefPtr<ScriptStreamer> protect(this);

    notifyFinishedToClient();

    if (m_mainThreadWaitingForParserThread) {
        ASSERT(m_parsingFinished);
        ASSERT(!m_streamingSuppressed);
        // streamingComplete won't be called, so do the ramp-down work
        // here.
        deref();
    }
}
コード例 #21
0
ファイル: plbt.c プロジェクト: darksage/lispbox
void
print_lisp_frame(lisp_frame *frame)
{
  LispObj fun = frame->savefn, pc = frame->savelr;
  int delta = 0;
  Dl_info info;
  char *spname;

  if ((fun == 0) || (fun == fulltag_misc)) {
    spname = "unknown ?";
#ifndef STATIC
    if (dladdr((void *)ptr_from_lispobj(pc), &info)) {
      spname = (char *)(info.dli_sname);
#ifdef DARWIN
      if (spname[-1] != '_') {
        --spname;
      }
#endif
    }
#endif
#ifdef PPC64
    Dprintf("(#x%016lX) #x%016lX : (subprimitive %s)", frame, pc, spname);
#else
    Dprintf("(#x%08X) #x%08X : (subprimitive %s)", frame, pc, spname);
#endif
  } else {
    if ((fulltag_of(fun) != fulltag_misc) ||
        (header_subtag(header_of(fun)) != subtag_function)) {
#ifdef PPC64
      Dprintf("(#x%016lX) #x%016lX : (not a function!)", frame, pc);
#else
      Dprintf("(#x%08X) #x%08X : (not a function!)", frame, pc);
#endif
    } else {
      LispObj code_vector = deref(fun, 1);
      
      if ((pc >= (code_vector+misc_data_offset)) &&
          (pc < ((code_vector+misc_data_offset)+(header_element_count(header_of(code_vector))<<2)))) {
        delta = (pc - (code_vector+misc_data_offset));
      }
#ifdef PPC64
      Dprintf("(#x%016lX) #x%016lX : %s + %d", frame, pc, print_lisp_object(fun), delta);
#else
      Dprintf("(#x%08X) #x%08X : %s + %d", frame, pc, print_lisp_object(fun), delta);
#endif
    }
  }
}
コード例 #22
0
ファイル: reader.c プロジェクト: anukat2015/serd
static Ref
read_BLANK_NODE_LABEL(SerdReader* reader, bool* ate_dot)
{
	eat_byte_safe(reader, '_');
	eat_byte_check(reader, ':');
	Ref ref = push_node(reader, SERD_BLANK,
	                    reader->bprefix ? (char*)reader->bprefix : "",
	                    reader->bprefix_len);

	uint8_t c = peek_byte(reader);  // First: (PN_CHARS | '_' | [0-9])
	if (is_digit(c) || c == '_') {
		push_byte(reader, ref, eat_byte_safe(reader, c));
	} else if (!read_PN_CHARS(reader, ref)) {
		r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid name start character\n");
		return pop_node(reader, ref);
	}

	while ((c = peek_byte(reader))) {  // Middle: (PN_CHARS | '.')*
		if (c == '.') {
			push_byte(reader, ref, eat_byte_safe(reader, c));
		} else if (!read_PN_CHARS(reader, ref)) {
			break;
		}
	}

	SerdNode* n = deref(reader, ref);
	if (n->buf[n->n_bytes - 1] == '.' && !read_PN_CHARS(reader, ref)) {
		// Ate trailing dot, pop it from stack/node and inform caller
		--n->n_bytes;
		serd_stack_pop(&reader->stack, 1);
		*ate_dot = true;
	}

	if (reader->syntax == SERD_TURTLE) {
		if (is_digit(n->buf[reader->bprefix_len + 1])) {
			if ((n->buf[reader->bprefix_len]) == 'b') {
				((char*)n->buf)[reader->bprefix_len] = 'B';  // Prevent clash
				reader->seen_genid = true;
			} else if (reader->seen_genid &&
			           n->buf[reader->bprefix_len] == 'B') {
				r_err(reader, SERD_ERR_ID_CLASH,
				      "found both `b' and `B' blank IDs, prefix required\n");
				return pop_node(reader, ref);
			}
		}
	}
	return ref;
}
コード例 #23
0
//remove the HalfEdge from the list of vertices 
void VoronoiDiagramGenerator::PQdelete(struct VoronoiDiagramGenerator::Halfedge *he)
{
	struct Halfedge *last;
	
	if(he -> vertex != (struct Site *) NULL)
	{	
		last = &PQhash[PQbucket(he)];
		while (last -> PQnext != he) 
			last = last -> PQnext;

		last -> PQnext = he -> PQnext;
		PQcount -= 1;
		deref(he -> vertex);
		he -> vertex = (struct Site *) NULL;
	};
}
コード例 #24
0
ファイル: minimise_types.c プロジェクト: klkblake/abcc
internal
Type *canonical_type(Type *type, TypePool *pool) {
	type = deref(type);
	if (IS_VAR(type)) {
		return type;
	}
	if (type->symbol == SYMBOL_UNIT) {
		return pool->unit;
	}
	if (type->symbol == SYMBOL_NUMBER) {
		return pool->number;
	}
	if (type->symbol == SYMBOL_BOOL) {
		return pool->boolean;
	}
}
コード例 #25
0
ファイル: RenderWidget.cpp プロジェクト: 335969568/Blink-1
void RenderWidget::destroy()
{
#if ENABLE(ASSERT) && ENABLE(OILPAN)
    ASSERT(!m_didCallDestroy);
    m_didCallDestroy = true;
#endif
    willBeDestroyed();
    clearNode();
#if ENABLE(OILPAN)
    // In Oilpan, postDestroy doesn't delete |this|. So calling it here is safe
    // though |this| will be referred in FrameView.
    postDestroy();
#else
    deref();
#endif
}
コード例 #26
0
ファイル: statsmanager.cpp プロジェクト: Shunty/mixxx
void StatsManager::run() {
    qDebug() << "StatsManager thread starting up.";
    while (true) {
        m_statsPipeLock.lock();
        m_statsPipeCondition.wait(&m_statsPipeLock);
        // We want to process reports even when we are about to quit since we
        // want to print the most accurate stat report on shutdown.
        processIncomingStatReports();
        m_statsPipeLock.unlock();

        if (deref(m_quit) == 1) {
            qDebug() << "StatsManager thread shutting down.";
            break;
        }
    }
}
コード例 #27
0
void MainResourceLoader::didCancel(const ResourceError& error)
{
    m_dataLoadTimer.stop();

    // Calling receivedMainResourceError will likely result in the last reference to this object to go away.
    RefPtr<MainResourceLoader> protect(this);

    if (m_waitingForContentPolicy) {
        frameLoader()->cancelContentPolicyCheck();
        ASSERT(m_waitingForContentPolicy);
        m_waitingForContentPolicy = false;
        deref(); // balances ref in didReceiveResponse
    }
    frameLoader()->receivedMainResourceError(error, true);
    ResourceLoader::didCancel(error);
}
コード例 #28
0
void NetworkResourceLoader::cleanup()
{
    ASSERT(RunLoop::isMain());

    invalidateSandboxExtensions();

    // Tell the scheduler about this finished loader soon so it can start more network requests.
    NetworkProcess::shared().networkResourceLoadScheduler().scheduleRemoveLoader(this);

    if (m_handle) {
        // Explicit deref() balanced by a ref() in NetworkResourceLoader::start()
        // This might cause the NetworkResourceLoader to be destroyed and therefore we do it last.
        m_handle = 0;
        deref();
    }
}
コード例 #29
0
ファイル: reader.c プロジェクト: 87maxi/oom
static inline void
push_byte(SerdReader* reader, Ref ref, const uint8_t c)
{
	#ifdef SERD_STACK_CHECK
	assert(stack_is_top_string(reader, ref));
	#endif
	serd_stack_push(&reader->stack, 1);
	SerdString* const str = deref(reader, ref);
	++str->n_bytes;
	if ((c & 0xC0) != 0x80) {
		// Does not start with `10', start of a new character
		++str->n_chars;
	}
	assert(str->n_bytes >= str->n_chars);
	str->buf[str->n_bytes - 1] = c;
	str->buf[str->n_bytes]     = '\0';
}
コード例 #30
0
void NetworkResourceLoader::cleanup()
{
    ASSERT(RunLoop::isMain());

    m_bufferingTimer.stop();

    invalidateSandboxExtensions();

    NetworkProcess::shared().networkResourceLoadScheduler().removeLoader(this);

    if (m_handle) {
        // Explicit deref() balanced by a ref() in NetworkResourceLoader::start()
        // This might cause the NetworkResourceLoader to be destroyed and therefore we do it last.
        m_handle = 0;
        deref();
    }
}