本文整理汇总了C++中sp::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::clear方法的具体用法?C++ sp::clear怎么用?C++ sp::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp
的用法示例。
在下文中一共展示了sp::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openInputChannelPair
status_t InputChannel::openInputChannelPair(const String8& name,
sp<InputChannel>& outServerChannel, sp<InputChannel>& outClientChannel) {
int sockets[2];
if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sockets)) {
status_t result = -errno;
ALOGE("channel '%s' ~ Could not create socket pair. errno=%d",
name.string(), errno);
outServerChannel.clear();
outClientChannel.clear();
return result;
}
int bufferSize = SOCKET_BUFFER_SIZE;
setsockopt(sockets[0], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize));
setsockopt(sockets[0], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize));
setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize));
setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize));
String8 serverChannelName = name;
serverChannelName.append(" (server)");
outServerChannel = new InputChannel(serverChannelName, sockets[0]);
String8 clientChannelName = name;
clientChannelName.append(" (client)");
outClientChannel = new InputChannel(clientChannelName, sockets[1]);
return OK;
}
示例2: binderDied
void GPUHardware::binderDied(const wp<IBinder>& who)
{
Mutex::Autolock _l(mLock);
pid_t pid = mRegisteredClients.valueFor(who);
if (pid != 0) {
ssize_t index = mClients.indexOfKey(pid);
if (index >= 0) {
//LOGD("*** removing client at %d", index);
Client& client(mClients.editValueAt(index));
client.revokeAllHeaps(); // not really needed in theory
mClients.removeItemsAt(index);
if (mClients.size() == 0) {
//LOGD("*** was last client closing everything");
mCallback.clear();
mAllocator.clear();
mCurrentAllocator.clear();
mSMIHeap.clear();
mREGHeap.clear();
// NOTE: we cannot clear the EBI heap because surfaceflinger
// itself may be using it, since this is where surfaces
// are allocated. if we're in the middle of compositing
// a surface (even if its process just died), we cannot
// rip the heap under our feet.
mOwner = NO_OWNER;
}
}
}
}
示例3: TearDown
virtual void TearDown() {
if (mPublisher) {
delete mPublisher;
mPublisher = NULL;
}
if (mConsumer) {
delete mConsumer;
mConsumer = NULL;
}
serverChannel.clear();
clientChannel.clear();
}