Example #1
0
void WorkerThreadableWebSocketChannel::Peer::didConnect()
{
    ASSERT(isMainThread());
    m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidConnect, m_workerClientWrapper.get(), m_mainWebSocketChannel->subprotocol(), m_mainWebSocketChannel->extensions()));
}
Example #2
0
static BuiltinResourceHandleSynchronousLoaderMap& builtinResourceHandleSynchronousLoaderMap()
{
    ASSERT(isMainThread());
    DEPRECATED_DEFINE_STATIC_LOCAL(BuiltinResourceHandleSynchronousLoaderMap, map, ());
    return map;
}
JSC::JSValue evaluateHandlerFromAnyThread(JSC::ExecState* exec, const JSC::SourceCode& source, JSC::JSValue thisValue, NakedPtr<JSC::Exception>& returnedException)
{
    if (isMainThread())
        return JSMainThreadExecState::evaluate(exec, source, thisValue, returnedException);
    return JSC::evaluate(exec, source, thisValue, returnedException);
}
Example #4
0
void overrideCookieStorage(CFHTTPCookieStorageRef cookieStorage)
{
    ASSERT(isMainThread());
    // FIXME: Why don't we retain it? The only caller is an API method that takes cookie storage as a raw argument.
    cookieStorageOverride().adoptCF(cookieStorage);
}
Example #5
0
WorkerMessagingProxy::~WorkerMessagingProxy()
{
    ASSERT(!m_workerObject);
    ASSERT((m_scriptExecutionContext->isDocument() && isMainThread())
           || (m_scriptExecutionContext->isWorkerContext() && currentThread() == static_cast<WorkerContext*>(m_scriptExecutionContext.get())->thread()->threadID()));
}
void CanvasAsyncBlobCreator::scheduleCreateBlobAndCallOnMainThread()
{
    ASSERT(!isMainThread());
    Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&CanvasAsyncBlobCreator::createBlobAndCall, AllowCrossThreadAccess(this)));
}
Example #7
0
void CoordinatedGraphicsScene::updateViewport()
{
    ASSERT(isMainThread());
    if (m_client)
        m_client->updateViewport();
}
Example #8
0
URL SecurityOrigin::urlWithUniqueSecurityOrigin()
{
    ASSERT(isMainThread());
    static NeverDestroyed<URL> uniqueSecurityOriginURL(ParsedURLString, ASCIILiteral("data:,"));
    return uniqueSecurityOriginURL;
}
Example #9
0
void enforceMainThread() {
	if (!isMainThread())
		throw Exception("Unsafe function called in non-main thread");
}
Example #10
0
void WorkerThreadableWebSocketChannel::Peer::didClose(unsigned long unhandledBufferedAmount, ClosingHandshakeCompletionStatus closingHandshakeCompletion, unsigned short code, const String& reason)
{
    ASSERT(isMainThread());
    m_mainWebSocketChannel = nullptr;
    m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidClose, m_workerClientWrapper.get(), unhandledBufferedAmount, closingHandshakeCompletion, code, reason));
}
Example #11
0
void WorkerThreadableWebSocketChannel::Peer::didReceiveMessageError()
{
    ASSERT(isMainThread());
    m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidReceiveMessageError, m_workerClientWrapper.get()));
}
Example #12
0
void WorkerThreadableWebSocketChannel::Peer::didStartClosingHandshake()
{
    ASSERT(isMainThread());
    m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidStartClosingHandshake, m_workerClientWrapper.get()));
}
Example #13
0
void WorkerThreadableWebSocketChannel::Peer::didUpdateBufferedAmount(unsigned long bufferedAmount)
{
    ASSERT(isMainThread());
    m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidUpdateBufferedAmount, m_workerClientWrapper.get(), bufferedAmount));
}
Example #14
0
void WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData)
{
    ASSERT(isMainThread());
    m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidReceiveBinaryData, m_workerClientWrapper.get(), binaryData));
}
v8::Isolate* V8PerIsolateData::mainThreadIsolate()
{
    ASSERT(isMainThread());
    ASSERT(mainThreadPerIsolateData);
    return mainThreadPerIsolateData->isolate();
}
Example #16
0
AudioBuffer* ConvolverNode::buffer()
{
    ASSERT(isMainThread());
    return m_buffer.get();
}
void CanvasAsyncBlobCreator::scheduleIdleEncodeRowsPng()
{
    ASSERT(isMainThread());
    Platform::current()->currentThread()->scheduler()->postIdleTask(BLINK_FROM_HERE, WTF::bind<double>(&CanvasAsyncBlobCreator::idleEncodeRowsPng, this));
}
Example #18
0
DatabaseManager& DatabaseManager::manager()
{
    ASSERT(isMainThread());
    DEFINE_STATIC_LOCAL(DatabaseManager, dbManager, ());
    return dbManager;
}
void CanvasAsyncBlobCreator::scheduleCreateNullptrAndCallOnMainThread()
{
    ASSERT(!isMainThread());
    Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&BlobCallback::handleEvent, m_callback.get(), nullptr));
    Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&CanvasAsyncBlobCreator::clearSelfReference, AllowCrossThreadAccess(this)));
}
Example #20
0
void Font::setShouldUseSmoothing(bool shouldUseSmoothing)
{
    ASSERT(isMainThread());
    shouldUseFontSmoothing = shouldUseSmoothing;
}
Example #21
0
AsyncFileStream::AsyncFileStream(FileStreamClient& client)
    : m_internals(std::make_unique<Internals>(client))
{
    ASSERT(isMainThread());
}
Example #22
0
Worker::~Worker()
{
    ASSERT(isMainThread());
    ASSERT(scriptExecutionContext()); // The context is protected by worker context proxy, so it cannot be destroyed while a Worker exists.
    m_contextProxy->workerObjectDestroyed();
}
Example #23
0
void CTabPanelWin::ShowSearchPane(bool bShow)
{
	if (bShow && gpSet->isMultiShowSearch)
	{
		_ASSERTE(isMainThread());
		if (!IsSearchShownInt(false))
		{
			REBARBANDINFO rbBand = {REBARBANDINFO_SIZE}; // не используем size, т.к. приходит "новый" размер из висты и в XP обламываемся

			HWND hFindPane = NULL;
			if (!mp_Find)
				mp_Find = new CFindPanel(gpConEmu);

			int iPaneHeight;
			SIZE sz = {0,0};
			if (mn_TabHeight > 0)
			{
				iPaneHeight = mn_TabHeight;
			}
			else if (mh_Toolbar)
			{
				SendMessage(mh_Toolbar, TB_GETMAXSIZE, 0, (LPARAM)&sz);
				iPaneHeight = sz.cy;
			}
			else
			{
				iPaneHeight = QueryTabbarHeight() - 4;
			}

			hFindPane = mp_Find->CreatePane(mh_Rebar, iPaneHeight);

			if (hFindPane)
			{
				rbBand.fMask  = RBBIM_SIZE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_ID | RBBIM_STYLE;
				rbBand.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDSIZE | RBBS_VARIABLEHEIGHT;

				#if 0
				rbBand.fMask |= RBBIM_COLORS;
				rbBand.clrFore = RGB(255,255,255);
				rbBand.clrBack = RGB(0,255,0);
				#endif

				rbBand.wID        = rbi_FindBar;
				rbBand.hwndChild  = hFindPane;
				rbBand.cx = rbBand.cxMinChild = rbBand.cxIdeal = mp_Find->GetMinWidth();
				rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = iPaneHeight + mn_ThemeHeightDiff;
			}

			// Insert before toolbar
			INT_PTR nPaneIndex = SendMessage(mh_Rebar, RB_IDTOINDEX, rbi_ToolBar, 0);
			if (nPaneIndex < 0) nPaneIndex = -1;

			if (!hFindPane
				|| !SendMessage(mh_Rebar, RB_INSERTBAND, nPaneIndex, (LPARAM)&rbBand)
				|| !mp_Find->OnCreateFinished())
			{
				DisplayLastError(_T("Can't initialize rebar (searchbar)"));
				bShow = false;
			}
		}
	}

	// Delete band?
	if (!bShow)
	{
		_ASSERTEX(!bShow);
		INT_PTR nPaneIndex = SendMessage(mh_Rebar, RB_IDTOINDEX, rbi_FindBar, 0);
		if (nPaneIndex >= 0)
		{
			SendMessage(mh_Rebar, RB_DELETEBAND, nPaneIndex, 0);
			SafeDelete(mp_Find);
		}
	}
}
Example #24
0
Image* Image::nullImage()
{
    ASSERT(isMainThread());
    static Image& nullImage = BitmapImage::create().leakRef();
    return &nullImage;
}
void CoordinatedGraphicsScene::detach()
{
    ASSERT(isMainThread());
    m_renderQueue.clear();
    m_client = 0;
}
Example #26
0
 explicit BatchedControlUpdate(MediaControls* controls)
     : m_controls(controls) {
   DCHECK(isMainThread());
   DCHECK_GE(s_batchDepth, 0);
   ++s_batchDepth;
 }
JSC::JSValue functionCallHandlerFromAnyThread(JSC::ExecState* exec, JSC::JSValue functionObject, JSC::CallType callType, const JSC::CallData& callData, JSC::JSValue thisValue, const JSC::ArgList& args, NakedPtr<JSC::Exception>& returnedException)
{
    if (isMainThread())
        return JSMainThreadExecState::call(exec, functionObject, callType, callData, thisValue, args, returnedException);
    return JSC::call(exec, functionObject, callType, callData, thisValue, args, returnedException);
}
Example #28
0
 ~BatchedControlUpdate() {
   DCHECK(isMainThread());
   DCHECK_GT(s_batchDepth, 0);
   if (!(--s_batchDepth))
     m_controls->computeWhichControlsFit();
 }
ScriptPromise OfflineAudioContext::suspendContext(ScriptState* scriptState, double when)
{
    ASSERT(isMainThread());

    ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
    ScriptPromise promise = resolver->promise();

    // The render thread does not exist; reject the promise.
    if (!destinationHandler().offlineRenderThread()) {
        resolver->reject(DOMException::create(InvalidStateError,
            "the rendering is already finished"));
        return promise;
    }

    // The specified suspend time is negative; reject the promise.
    if (when < 0) {
        resolver->reject(DOMException::create(InvalidStateError,
            "negative suspend time (" + String::number(when) + ") is not allowed"));
        return promise;
    }

    // Quantize (to the lower boundary) the suspend time by the render quantum.
    size_t frame = when * sampleRate();
    frame -= frame % destinationHandler().renderQuantumFrames();

    // The suspend time should be earlier than the total render frame. If the
    // requested suspension time is equal to the total render frame, the promise
    // will be rejected.
    if (m_totalRenderFrames <= frame) {
        resolver->reject(DOMException::create(InvalidStateError,
            "cannot schedule a suspend at frame " + String::number(frame) +
            " (" + String::number(when) + " seconds) " +
            "because it is greater than or equal to the total render duration of " +
            String::number(m_totalRenderFrames) + " frames"));
        return promise;
    }

    // The specified suspend time is in the past; reject the promise.
    if (frame < currentSampleFrame()) {
        resolver->reject(DOMException::create(InvalidStateError,
            "cannot schedule a suspend at frame " +
            String::number(frame) + " (" + String::number(when) +
            " seconds) because it is earlier than the current frame of " +
            String::number(currentSampleFrame()) + " (" +
            String::number(currentTime()) + " seconds)"));
        return promise;
    }

    // Wait until the suspend map is available for the insertion. Here we should
    // use AutoLocker because it locks the graph from the main thread.
    AutoLocker locker(this);

    // If there is a duplicate suspension at the same quantized frame,
    // reject the promise.
    if (m_scheduledSuspends.contains(frame)) {
        resolver->reject(DOMException::create(InvalidStateError,
            "cannot schedule more than one suspend at frame " +
            String::number(frame) + " (" +
            String::number(when) + " seconds)"));
        return promise;
    }

    m_scheduledSuspends.add(frame, resolver);

    return promise;
}
Example #30
0
void WorkerThreadableWebSocketChannel::Peer::destroy()
{
    ASSERT(isMainThread());
    delete this;
}