Exemplo n.º 1
0
    void EXPECT_CALLHttpServer()
    {
        EXPECT_CALL(m_HttpServer, AddReference()).WillRepeatedly(testing::Return(1));
        EXPECT_CALL(m_HttpServer, ReleaseReference()).WillRepeatedly(testing::Return(1));
        EXPECT_CALL(m_HttpServer, OpenWithSink(testing::_)).WillRepeatedly(testing::Return(CM_OK));
        EXPECT_CALL(m_HttpServer, Disconnect(testing::_)).WillRepeatedly(testing::Return(CM_OK));
        EXPECT_CALL(m_HttpServer, SendData(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK));

        EXPECT_CALL(m_HttpServer, GetRequestHeader(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK));
        EXPECT_CALL(m_HttpServer, SetOrAddResponseHeader(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK));

        EXPECT_CALL(m_HttpServer, SetOption(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK));
        EXPECT_CALL(m_HttpServer, GetOption(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK));
    
        EXPECT_CALL(m_HttpServer2, AddReference()).WillRepeatedly(testing::Return(1));
        EXPECT_CALL(m_HttpServer2, ReleaseReference()).WillRepeatedly(testing::Return(1));
        EXPECT_CALL(m_HttpServer2, OpenWithSink(testing::_)).WillRepeatedly(testing::Return(CM_OK));
        EXPECT_CALL(m_HttpServer2, Disconnect(testing::_)).WillRepeatedly(testing::Return(CM_OK));
        EXPECT_CALL(m_HttpServer2, SendData(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK));

        EXPECT_CALL(m_HttpServer2, GetRequestHeader(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK));
        EXPECT_CALL(m_HttpServer2, SetOrAddResponseHeader(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK));

        EXPECT_CALL(m_HttpServer2, SetOption(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK));
        EXPECT_CALL(m_HttpServer2, GetOption(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK));
    }
Exemplo n.º 2
0
ECode CursorWindow::FreeLastRow()
{
    AcquireReference();
    //try {
    NativeFreeLastRow();
    //} finally {
    ReleaseReference();
    //}
    return NOERROR;
}
Exemplo n.º 3
0
Boolean CursorWindow::AllocRow()
{
    AcquireReference();
    //try {
    Boolean result = NativeAllocRow();
    //} finally {
    ReleaseReference();
    //}
    return result;
}
Exemplo n.º 4
0
Int32 CursorWindow::GetNumRows()
{
    AcquireReference();
    //try {
    Int32 num = NativeGetNumRows();
    //} finally {
    ReleaseReference();
    //}
    return num;
}
Exemplo n.º 5
0
ECode CursorWindow::Clear()
{
    AcquireReference();
    //try {
    mStartPos = 0;
    NativeClear();
    //} finally {
    ReleaseReference();
    //}
    return NOERROR;
}
Exemplo n.º 6
0
Boolean CursorWindow::SetNumColumns(
    /* [in] */ Int32 columnNum)
{
    AcquireReference();
    //try {
    Boolean result = NativeSetNumColumns(columnNum);
    //} finally {
    ReleaseReference();
    //}
    return result;
}
Exemplo n.º 7
0
Boolean CursorWindow::IsNull(
    /* [in] */ Int32 row,
    /* [in] */ Int32 col)
{
    AcquireReference();
    //try {
    Boolean isNull = NativeIsNull(row - mStartPos, col);
    //} finally {
    ReleaseReference();
    //}
    return isNull;
}
Exemplo n.º 8
0
Boolean CursorWindow::PutNull(
    /* [in] */ Int32 row,
    /* [in] */ Int32 col)
{
    AcquireReference();
    //try {
    Boolean result = NativePutNull(row - mStartPos, col);
    //} finally {
    ReleaseReference();
    //}
    return result;
}
Exemplo n.º 9
0
Boolean CursorWindow::PutBlob(
    /* [in] */ const ArrayOf<Byte> & value,
    /* [in] */ Int32 row,
    /* [in] */ Int32 col)
{
    AcquireReference();
    //try {
    Boolean result = NativePutBlob(value, row - mStartPos, col);
    //} finally {
    ReleaseReference();
    //}
    return result;
}
Exemplo n.º 10
0
ECode CursorWindow::GetDouble(
    /* [in] */ Int32 row,
    /* [in] */ Int32 col,
    /* [out] */ Double* value)
{
    AcquireReference();
    //try {
    ECode ec = NativeGetDouble(row - mStartPos, col, value);
    //} finally {
    ReleaseReference();
    //}
    return ec;
}
Exemplo n.º 11
0
ECode CursorWindow::GetString(
    /* [in] */ Int32 row,
    /* [in] */ Int32 col,
    /* [out] */ String* str)
{
    AcquireReference();
    //try {
    ECode ec = NativeGetString(row - mStartPos, col, str);
    //} finally {
    ReleaseReference();
    //}
    return ec;
}
Exemplo n.º 12
0
ECode CursorWindow::IsString(
    /* [in] */ Int32 row,
    /* [in] */ Int32 col,
    /* [out] */ Boolean* isString)
{
    AcquireReference();
    //try {
    ECode ec = NativeIsString(row - mStartPos, col, isString);
    //} finally {
    ReleaseReference();
    //}
    return ec;
}
Exemplo n.º 13
0
ECode CursorWindow::GetBlob(
    /* [in] */ Int32 row,
    /* [in] */ Int32 col,
    /* [out] */ ArrayOf<Byte>** blob)
{
    AcquireReference();
    //try {
    ECode ec = NativeGetBlob(row - mStartPos, col, blob);
    //} finally {
    ReleaseReference();
    //}
    return ec;
}
Exemplo n.º 14
0
void
CreateThreadEvent::DoDPC(DPCQueue* queue)
{
	// We're no longer queued in the DPC queue, so we can be reused.
	atomic_set(&fPendingDPC, 0);

	// create the thread
	thread_id threadID = thread_create_thread(fCreationAttributes, false);
	if (threadID >= 0)
		resume_thread(threadID);

	ReleaseReference();
}
Exemplo n.º 15
0
ECode CursorWindow::GetInt32(
    /* [in] */ Int32 row,
    /* [in] */ Int32 col,
    /* [out] */ Int32* value)
{
    AcquireReference();
    //try {
    Int64 i64Value;
    ECode ec = NativeGetInt64(row - mStartPos, col, &i64Value);
    *value = (Int32)i64Value;
    //} finally {
    ReleaseReference();
    //}
    return ec;
}
Exemplo n.º 16
0
ECode CursorWindow::GetFloat(
    /* [in] */ Int32 row,
    /* [in] */ Int32 col,
    /* [out] */ Float* value)
{
    AcquireReference();
    //try {
    Double dValue;
    ECode ec = NativeGetDouble(row - mStartPos, col, &dValue);
    *value = dValue;
    //} finally {
    ReleaseReference();
    //}
    return ec;
}
Exemplo n.º 17
0
void
net_socket_private::RemoveFromParent()
{
	ASSERT(!is_in_socket_list && parent != NULL);

	parent = NULL;

	mutex_lock(&sSocketLock);
	sSocketList.Add(this);
	mutex_unlock(&sSocketLock);

	is_in_socket_list = true;

	ReleaseReference();
}
Exemplo n.º 18
0
void
UnixEndpoint::Uninit()
{
	TRACE("[%ld] %p->UnixEndpoint::Uninit()\n", find_thread(NULL), this);

	// check whether we're closed
	UnixEndpointLocker locker(this);
	bool closed = (fState == UNIX_ENDPOINT_CLOSED);
	locker.Unlock();

	if (!closed) {
		// That probably means, we're a child endpoint of a listener and
		// have been fully connected, but not yet accepted. Our Close()
		// hook isn't called in this case. Do it manually.
		Close();
	}

	ReleaseReference();
}
Exemplo n.º 19
0
void
TeamSignalEvent::DoDPC(DPCQueue* queue)
{
	fSignal->AcquireReference();
		// one reference is transferred to send_signal_to_team_locked

	InterruptsSpinLocker locker(fTeam->signal_lock);
	status_t error = send_signal_to_team_locked(fTeam, fSignal->Number(),
		fSignal, B_DO_NOT_RESCHEDULE);
	locker.Unlock();

	// There are situations (for certain signals), in which
	// send_signal_to_team_locked() succeeds without queuing the signal.
	if (error != B_OK || !fSignal->IsPending())
		fSignal->SetUnused();

	// We're no longer queued in the DPC queue, so we can be reused.
	atomic_set(&fPendingDPC, 0);

	ReleaseReference();
}
Exemplo n.º 20
0
void
SystemProfiler::EventOccurred(NotificationService& service,
	const KMessage* event)
{
	int32 eventCode;
	if (event->FindInt32("event", &eventCode) != B_OK)
		return;

	if (strcmp(service.Name(), "teams") == 0) {
		Team* team = (Team*)event->GetPointer("teamStruct", NULL);
		if (team == NULL)
			return;

		switch (eventCode) {
			case TEAM_ADDED:
				if (fTeamNotificationsEnabled)
					_TeamAdded(team);
				break;

			case TEAM_REMOVED:
				if (team->id == fTeam) {
					// The profiling team is gone -- uninstall the profiler!
					InterruptsSpinLocker locker(sProfilerLock);
					if (sProfiler != this)
						return;

					sProfiler = NULL;
					locker.Unlock();

					ReleaseReference();
					return;
				}

				// When we're still doing the initial team list scan, we are
				// also interested in removals that happened to teams we have
				// already seen.
				if (fTeamNotificationsEnabled
					|| team->serial_number <= fLastTeamAddedSerialNumber) {
					_TeamRemoved(team);
				}
				break;

			case TEAM_EXEC:
				if (fTeamNotificationsEnabled)
					_TeamExec(team);
				break;
		}
	} else if (strcmp(service.Name(), "threads") == 0) {
		Thread* thread = (Thread*)event->GetPointer("threadStruct", NULL);
		if (thread == NULL)
			return;

		switch (eventCode) {
			case THREAD_ADDED:
				if (fThreadNotificationsEnabled)
					_ThreadAdded(thread);
				break;

			case THREAD_REMOVED:
				// When we're still doing the initial thread list scan, we are
				// also interested in removals that happened to threads we have
				// already seen.
				if (fThreadNotificationsEnabled
					|| thread->serial_number <= fLastThreadAddedSerialNumber) {
					_ThreadRemoved(thread);
				}
				break;
		}
	} else if (strcmp(service.Name(), "images") == 0) {
		if (!fImageNotificationsEnabled)
			return;

		struct image* image = (struct image*)event->GetPointer(
			"imageStruct", NULL);
		if (image == NULL)
			return;

		switch (eventCode) {
			case IMAGE_ADDED:
				_ImageAdded(image);
				break;

			case IMAGE_REMOVED:
				_ImageRemoved(image);
				break;
		}
	} else if (strcmp(service.Name(), "I/O") == 0) {
		if (!fIONotificationsEnabled)
			return;

		IOScheduler* scheduler = (IOScheduler*)event->GetPointer("scheduler",
			NULL);
		if (scheduler == NULL)
			return;

		IORequest* request = (IORequest*)event->GetPointer("request", NULL);
		IOOperation* operation = (IOOperation*)event->GetPointer("operation",
			NULL);

		switch (eventCode) {
			case IO_SCHEDULER_ADDED:
				_IOSchedulerAdded(scheduler);
				break;

			case IO_SCHEDULER_REMOVED:
				_IOSchedulerRemoved(scheduler);
				break;

			case IO_SCHEDULER_REQUEST_SCHEDULED:
				_IORequestScheduled(scheduler, request);
				break;

			case IO_SCHEDULER_REQUEST_FINISHED:
				_IORequestFinished(scheduler, request);
				break;

			case IO_SCHEDULER_OPERATION_STARTED:
				_IOOperationStarted(scheduler, request, operation);
				break;

			case IO_SCHEDULER_OPERATION_FINISHED:
				_IOOperationFinished(scheduler, request, operation);
				break;
		}
	}

	_MaybeNotifyProfilerThread();
}
Exemplo n.º 21
0
 void EXPECT_CALLHTTPExProtoHandle()
 {
     EXPECT_CALL(m_HTTPExHandle, AddReference()).WillRepeatedly(testing::Return(1));
     EXPECT_CALL(m_HTTPExHandle, ReleaseReference()).WillRepeatedly(testing::Return(1));
 }
Exemplo n.º 22
0
ECode CursorWindow::Close()
{
    ReleaseReference();
    return NOERROR;
}